"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _try = _interopRequireDefault(require("../../lib/data/try"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
/*
  ======== A Handy Little Nodeunit Reference ========
  https://github.com/caolan/nodeunit

  Test methods:
    test.expect(numAssertions)
    test.done()
  Test assertions:
    test.ok(value, [message])
    test.equal(actual, expected, [message])
    test.notEqual(actual, expected, [message])
    test.deepEqual(actual, expected, [message])
    test.notDeepEqual(actual, expected, [message])
    test.strictEqual(actual, expected, [message])
    test.notStrictEqual(actual, expected, [message])
    test.throws(block, [error], [message])
    test.doesNotThrow(block, [error], [message])
    test.ifError(value)
*/
var _default = exports["default"] = {
  setUp: function setUp(done) {
    done();
  },
  'atry success': function atry_success(test) {
    test.expect(1);
    // tests here
    test.ok(_try["default"].success(1).isSuccess(), 'should be success.');
    test.done();
  },
  'atry failure': function atry_failure(test) {
    test.expect(1);
    // tests here
    test.ok(_try["default"].failure(1).isFailure(), 'should be failure.');
    test.done();
  },
  'atry success map can be a success': function atry_success_map_can_be_a_success(test) {
    test.expect(1);
    // tests here
    test.ok(_try["default"].success(1).map(function (i) {
      return i + 1;
    }).isSuccess(), 'should be success.');
    test.done();
  },
  'atry success map can be a failure': function atry_success_map_can_be_a_failure(test) {
    test.expect(1);
    // tests here
    test.ok(_try["default"].success(1).map(function () {
      throw new Error();
    }).isFailure(), 'should be failure.');
    test.done();
  },
  'atry success map': function atry_success_map(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).map(function (i) {
      return i + 1;
    }).success(), 2, 'should be success.');
    test.done();
  },
  'atry failure map is a failure': function atry_failure_map_is_a_failure(test) {
    test.expect(1);
    // tests here
    test.ok(_try["default"].failure(1).map(function (i) {
      return i + 1;
    }).isFailure(), 'should be failure.');
    test.done();
  },
  'atry failure map': function atry_failure_map(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].failure(1).map(function (i) {
      return i + 1;
    }).failure(), 1, 'should be failure.');
    test.done();
  },
  'atry success flatMap of atry': function atry_success_flatMap_of_atry(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).flatMap(function (i) {
      return _try["default"].success(i + 1);
    }).success(), 2, 'should be success.');
    test.done();
  },
  'atry failure flatMap of int': function atry_failure_flatMap_of_int(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].failure(1).flatMap(function (i) {
      return i + 1;
    }).failure(), 1, 'should be failure.');
    test.done();
  },
  'atry failure flatMap of Error': function atry_failure_flatMap_of_Error(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).flatMap(function () {
      throw 1;
    }).failure(), 1, 'should be failure.');
    test.done();
  },
  'atry success recoverWith': function atry_success_recoverWith(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).recoverWith(2), 1, 'should be success.');
    test.done();
  },
  'atry failure recoverWith': function atry_failure_recoverWith(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].failure(1).recoverWith(2), 2, 'should be failure.');
    test.done();
  },
  'atry success lazyRecoverWith': function atry_success_lazyRecoverWith(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).lazyRecoverWith(function () {
      return 2;
    }), 1, 'should be success.');
    test.done();
  },
  'atry failure lazyRecoverWith': function atry_failure_lazyRecoverWith(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].failure(1).lazyRecoverWith(function () {
      return 2;
    }), 2, 'should be failure.');
    test.done();
  },
  'atry success filter': function atry_success_filter(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).filter(function (v) {
      return v === 1;
    }).isSuccess(), true, 'should be success.');
    test.done();
  },
  'atry success wrong filter': function atry_success_wrong_filter(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].success(1).filter(function (v) {
      return v === 2;
    }).isFailure(), true, 'should be failure.');
    test.done();
  },
  'atry failure filter': function atry_failure_filter(test) {
    test.expect(1);
    // tests here
    test.equal(_try["default"].failure(1).filter(function (v) {
      return v === 1;
    }).isFailure(), true, 'should be failure.');
    test.done();
  },
  'atry success onSuccess': function atry_success_onSuccess(test) {
    test.expect(1);
    // tests here
    var success = false;
    _try["default"].success(1).onSuccess(function () {
      success = true;
    });
    test.equal(success, true, 'should be true.');
    test.done();
  },
  'atry failure onSuccess': function atry_failure_onSuccess(test) {
    test.expect(1);
    // tests here
    var success = false;
    _try["default"].failure().onSuccess(function () {
      success = true;
    });
    test.equal(success, false, 'should be false.');
    test.done();
  },
  'atry success onFailure': function atry_success_onFailure(test) {
    test.expect(1);
    // tests here
    var failure = false;
    _try["default"].success(1).onFailure(function () {
      failure = true;
    });
    test.equal(failure, false, 'should be false.');
    test.done();
  },
  'atry failure onFailure': function atry_failure_onFailure(test) {
    test.expect(1);
    // tests here
    var failure = false;
    _try["default"].failure().onFailure(function () {
      failure = true;
    });
    test.equal(failure, true, 'should be true.');
    test.done();
  }
};
//# sourceMappingURL=try_test.js.map