UNPKG

assertthat

Version:
418 lines (417 loc) 24.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getNegatedCombinedAssertionsForEach = exports.getCombinedAssertionsForEach = exports.getNegatedCombinedAssertions = exports.getCombinedAssertions = void 0; const assertActualIsAnError_1 = require("./assertActualIsAnError"); const assertActualIsAnErrorWithMessage_1 = require("./assertActualIsAnErrorWithMessage"); const assertActualIsAtLeast_1 = require("./assertActualIsAtLeast"); const assertActualIsAtMost_1 = require("./assertActualIsAtMost"); const assertActualIsAValue_1 = require("./assertActualIsAValue"); const assertActualIsContaining_1 = require("./assertActualIsContaining"); const assertActualIsContainingAllOf_1 = require("./assertActualIsContainingAllOf"); const assertActualIsContainingAnyOf_1 = require("./assertActualIsContainingAnyOf"); const assertActualIsEmpty_1 = require("./assertActualIsEmpty"); const assertActualIsEndingWith_1 = require("./assertActualIsEndingWith"); const assertActualIsEqualTo_1 = require("./assertActualIsEqualTo"); const assertActualIsFalse_1 = require("./assertActualIsFalse"); const assertActualIsFalsy_1 = require("./assertActualIsFalsy"); const assertActualIsGreaterThan_1 = require("./assertActualIsGreaterThan"); const assertActualIsIdenticalTo_1 = require("./assertActualIsIdenticalTo"); const assertActualIsInstanceOf_1 = require("./assertActualIsInstanceOf"); const assertActualIsLessThan_1 = require("./assertActualIsLessThan"); const assertActualIsMatching_1 = require("./assertActualIsMatching"); const assertActualIsNaN_1 = require("./assertActualIsNaN"); const assertActualIsNotAnError_1 = require("./negated/assertActualIsNotAnError"); const assertActualIsNotAnErrorWithMessage_1 = require("./negated/assertActualIsNotAnErrorWithMessage"); const assertActualIsNotAtLeast_1 = require("./negated/assertActualIsNotAtLeast"); const assertActualIsNotAtMost_1 = require("./negated/assertActualIsNotAtMost"); const assertActualIsNotAValue_1 = require("./negated/assertActualIsNotAValue"); const assertActualIsNotContaining_1 = require("./negated/assertActualIsNotContaining"); const assertActualIsNotContainingAllOf_1 = require("./negated/assertActualIsNotContainingAllOf"); const assertActualIsNotContainingAnyOf_1 = require("./negated/assertActualIsNotContainingAnyOf"); const assertActualIsNotEmpty_1 = require("./negated/assertActualIsNotEmpty"); const assertActualIsNotEndingWith_1 = require("./negated/assertActualIsNotEndingWith"); const assertActualIsNotEqualTo_1 = require("./negated/assertActualIsNotEqualTo"); const assertActualIsNotFalse_1 = require("./negated/assertActualIsNotFalse"); const assertActualIsNotFalsy_1 = require("./negated/assertActualIsNotFalsy"); const assertActualIsNotGreaterThan_1 = require("./negated/assertActualIsNotGreaterThan"); const assertActualIsNotIdenticalTo_1 = require("./negated/assertActualIsNotIdenticalTo"); const assertActualIsNotInstanceOf_1 = require("./negated/assertActualIsNotInstanceOf"); const assertActualIsNotLessThan_1 = require("./negated/assertActualIsNotLessThan"); const assertActualIsNotMatching_1 = require("./negated/assertActualIsNotMatching"); const assertActualIsNotNaN_1 = require("./negated/assertActualIsNotNaN"); const assertActualIsNotNull_1 = require("./negated/assertActualIsNotNull"); const assertActualIsNotOfType_1 = require("./negated/assertActualIsNotOfType"); const assertActualIsNotSameJsonAs_1 = require("./negated/assertActualIsNotSameJsonAs"); const assertActualIsNotStartingWith_1 = require("./negated/assertActualIsNotStartingWith"); const assertActualIsNotThrowing_1 = require("./negated/assertActualIsNotThrowing"); const assertActualIsNotThrowingAsync_1 = require("./negated/assertActualIsNotThrowingAsync"); const assertActualIsNotTrue_1 = require("./negated/assertActualIsNotTrue"); const assertActualIsNotTruthy_1 = require("./negated/assertActualIsNotTruthy"); const assertActualIsNotUndefined_1 = require("./negated/assertActualIsNotUndefined"); const assertActualIsNull_1 = require("./assertActualIsNull"); const assertActualIsOfType_1 = require("./assertActualIsOfType"); const assertActualIsSameJsonAs_1 = require("./assertActualIsSameJsonAs"); const assertActualIsStartingWith_1 = require("./assertActualIsStartingWith"); const assertActualIsThrowing_1 = require("./assertActualIsThrowing"); const assertActualIsThrowingAsync_1 = require("./assertActualIsThrowingAsync"); const assertActualIsTrue_1 = require("./assertActualIsTrue"); const assertActualIsTruthy_1 = require("./assertActualIsTruthy"); const assertActualIsUndefined_1 = require("./assertActualIsUndefined"); const report_1 = require("../../report"); const wrapAssertionForIterable_1 = require("../../wrapAssertionForIterable"); const getCombinedAssertions = function (actual) { return { anError() { (0, report_1.report)((0, assertActualIsAnError_1.assertActualIsAnError)(actual)); }, anErrorWithMessage(expected) { (0, report_1.report)((0, assertActualIsAnErrorWithMessage_1.assertActualIsAnErrorWithMessage)(actual, expected)); }, atLeast(expected) { (0, report_1.report)((0, assertActualIsAtLeast_1.assertActualIsAtLeast)(actual, expected)); }, atMost(expected) { (0, report_1.report)((0, assertActualIsAtMost_1.assertActualIsAtMost)(actual, expected)); }, aValue() { (0, report_1.report)((0, assertActualIsAValue_1.assertActualIsAValue)(actual)); }, containing(expected) { (0, report_1.report)((0, assertActualIsContaining_1.assertActualIsContaining)(actual, expected)); }, containingAllOf(expected) { (0, report_1.report)((0, assertActualIsContainingAllOf_1.assertActualIsContainingAllOf)(actual, expected)); }, containingAnyOf(expected) { (0, report_1.report)((0, assertActualIsContainingAnyOf_1.assertActualIsContainingAnyOf)(actual, expected)); }, empty() { (0, report_1.report)((0, assertActualIsEmpty_1.assertActualIsEmpty)(actual)); }, endingWith(expected) { (0, report_1.report)((0, assertActualIsEndingWith_1.assertActualIsEndingWithActual)(actual, expected)); }, equalTo(expected) { (0, report_1.report)((0, assertActualIsEqualTo_1.assertActualIsEqualTo)(actual, expected)); }, false() { (0, report_1.report)((0, assertActualIsFalse_1.assertActualIsFalse)(actual)); }, falsy() { (0, report_1.report)((0, assertActualIsFalsy_1.assertActualIsFalsy)(actual)); }, greaterThan(expected) { (0, report_1.report)((0, assertActualIsGreaterThan_1.assertActualIsGreaterThan)(actual, expected)); }, identicalTo(expected) { (0, report_1.report)((0, assertActualIsIdenticalTo_1.assertActualIsIdenticalTo)(actual, expected)); }, instanceOf(expected) { (0, report_1.report)((0, assertActualIsInstanceOf_1.assertActualIsInstanceOf)(actual, expected)); }, lessThan(expected) { (0, report_1.report)((0, assertActualIsLessThan_1.assertActualIsLessThan)(actual, expected)); }, matching(expected) { (0, report_1.report)((0, assertActualIsMatching_1.assertActualIsMatching)(actual, expected)); }, NaN() { (0, report_1.report)((0, assertActualIsNaN_1.assertActualIsNaN)(actual)); }, null() { (0, report_1.report)((0, assertActualIsNull_1.assertActualIsNull)(actual)); }, ofType(expected) { (0, report_1.report)((0, assertActualIsOfType_1.assertActualIsOfType)(actual, expected)); }, sameJsonAs(expected) { (0, report_1.report)((0, assertActualIsSameJsonAs_1.assertActualIsSameJsonAs)(actual, expected)); }, startingWith(expected) { (0, report_1.report)((0, assertActualIsStartingWith_1.assertActualIsStartingWith)(actual, expected)); }, throwing(expected) { (0, report_1.report)((0, assertActualIsThrowing_1.assertActualIsThrowing)(actual, expected)); }, async throwingAsync(expected) { (0, report_1.report)(await (0, assertActualIsThrowingAsync_1.assertActualIsThrowingAsync)(actual, expected)); }, true() { (0, report_1.report)((0, assertActualIsTrue_1.assertActualIsTrue)(actual)); }, truthy() { (0, report_1.report)((0, assertActualIsTruthy_1.assertActualIsTruthy)(actual)); }, undefined() { (0, report_1.report)((0, assertActualIsUndefined_1.assertActualIsUndefined)(actual)); } }; }; exports.getCombinedAssertions = getCombinedAssertions; const getNegatedCombinedAssertions = function (actual) { return { anError() { (0, report_1.report)((0, assertActualIsNotAnError_1.assertActualIsNotAnError)(actual)); }, anErrorWithMessage(expected) { (0, report_1.report)((0, assertActualIsNotAnErrorWithMessage_1.assertActualIsNotAnErrorWithMessage)(actual, expected)); }, atLeast(expected) { (0, report_1.report)((0, assertActualIsNotAtLeast_1.assertActualIsNotAtLeast)(actual, expected)); }, atMost(expected) { (0, report_1.report)((0, assertActualIsNotAtMost_1.assertActualIsNotAtMost)(actual, expected)); }, aValue() { (0, report_1.report)((0, assertActualIsNotAValue_1.assertActualIsNotAValue)(actual)); }, containing(expected) { (0, report_1.report)((0, assertActualIsNotContaining_1.assertActualIsNotContaining)(actual, expected)); }, containingAllOf(expected) { (0, report_1.report)((0, assertActualIsNotContainingAllOf_1.assertActualIsNotContainingAllOf)(actual, expected)); }, containingAnyOf(expected) { (0, report_1.report)((0, assertActualIsNotContainingAnyOf_1.assertActualIsNotContainingAnyOf)(actual, expected)); }, empty() { (0, report_1.report)((0, assertActualIsNotEmpty_1.assertActualIsNotEmpty)(actual)); }, endingWith(expected) { (0, report_1.report)((0, assertActualIsNotEndingWith_1.assertActualIsNotEndingWithActual)(actual, expected)); }, equalTo(expected) { (0, report_1.report)((0, assertActualIsNotEqualTo_1.assertActualIsNotEqualTo)(actual, expected)); }, false() { (0, report_1.report)((0, assertActualIsNotFalse_1.assertActualIsNotFalse)(actual)); }, falsy() { (0, report_1.report)((0, assertActualIsNotFalsy_1.assertActualIsNotFalsy)(actual)); }, greaterThan(expected) { (0, report_1.report)((0, assertActualIsNotGreaterThan_1.assertActualIsNotGreaterThan)(actual, expected)); }, identicalTo(expected) { (0, report_1.report)((0, assertActualIsNotIdenticalTo_1.assertActualIsNotIdenticalTo)(actual, expected)); }, instanceOf(expected) { (0, report_1.report)((0, assertActualIsNotInstanceOf_1.assertActualIsNotInstanceOf)(actual, expected)); }, lessThan(expected) { (0, report_1.report)((0, assertActualIsNotLessThan_1.assertActualIsNotLessThan)(actual, expected)); }, matching(expected) { (0, report_1.report)((0, assertActualIsNotMatching_1.assertActualIsNotMatching)(actual, expected)); }, NaN() { (0, report_1.report)((0, assertActualIsNotNaN_1.assertActualIsNotNaN)(actual)); }, null() { (0, report_1.report)((0, assertActualIsNotNull_1.assertActualIsNotNull)(actual)); }, ofType(expected) { (0, report_1.report)((0, assertActualIsNotOfType_1.assertActualIsNotOfType)(actual, expected)); }, sameJsonAs(expected) { (0, report_1.report)((0, assertActualIsNotSameJsonAs_1.assertActualIsNotSameJsonAs)(actual, expected)); }, startingWith(expected) { (0, report_1.report)((0, assertActualIsNotStartingWith_1.assertActualIsNotStartingWith)(actual, expected)); }, throwing(expected) { (0, report_1.report)((0, assertActualIsNotThrowing_1.assertActualIsNotThrowing)(actual, expected)); }, async throwingAsync(expected) { (0, report_1.report)(await (0, assertActualIsNotThrowingAsync_1.assertActualIsNotThrowingAsync)(actual, expected)); }, true() { (0, report_1.report)((0, assertActualIsNotTrue_1.assertActualIsNotTrue)(actual)); }, truthy() { (0, report_1.report)((0, assertActualIsNotTruthy_1.assertActualIsNotTruthy)(actual)); }, undefined() { (0, report_1.report)((0, assertActualIsNotUndefined_1.assertActualIsNotUndefined)(actual)); } }; }; exports.getNegatedCombinedAssertions = getNegatedCombinedAssertions; const getCombinedAssertionsForEach = function (actual) { return { anError() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsAnError_1.assertActualIsAnError)(actual)); }, anErrorWithMessage(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsAnErrorWithMessage_1.assertActualIsAnErrorWithMessage)(actual, expected)); }, atLeast(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsAtLeast_1.assertActualIsAtLeast)(actual, expected)); }, atMost(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsAtMost_1.assertActualIsAtMost)(actual, expected)); }, aValue() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsAValue_1.assertActualIsAValue)(actual)); }, containing(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsContaining_1.assertActualIsContaining)(actual, expected)); }, containingAllOf(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsContainingAllOf_1.assertActualIsContainingAllOf)(actual, expected)); }, containingAnyOf(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsContainingAnyOf_1.assertActualIsContainingAnyOf)(actual, expected)); }, empty() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsEmpty_1.assertActualIsEmpty)(actual)); }, endingWith(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsEndingWith_1.assertActualIsEndingWithActual)(actual, expected)); }, equalTo(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsEqualTo_1.assertActualIsEqualTo)(actual, expected)); }, false() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsFalse_1.assertActualIsFalse)(actual)); }, falsy() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsFalsy_1.assertActualIsFalsy)(actual)); }, greaterThan(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsGreaterThan_1.assertActualIsGreaterThan)(actual, expected)); }, identicalTo(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsIdenticalTo_1.assertActualIsIdenticalTo)(actual, expected)); }, instanceOf(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsInstanceOf_1.assertActualIsInstanceOf)(actual, expected)); }, lessThan(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsLessThan_1.assertActualIsLessThan)(actual, expected)); }, matching(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsMatching_1.assertActualIsMatching)(actual, expected)); }, NaN() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNaN_1.assertActualIsNaN)(actual)); }, null() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNull_1.assertActualIsNull)(actual)); }, ofType(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsOfType_1.assertActualIsOfType)(actual, expected)); }, sameJsonAs(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsSameJsonAs_1.assertActualIsSameJsonAs)(actual, expected)); }, startingWith(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsStartingWith_1.assertActualIsStartingWith)(actual, expected)); }, throwing(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsThrowing_1.assertActualIsThrowing)(actual, expected)); }, async throwingAsync(expected) { (0, report_1.report)(await (0, wrapAssertionForIterable_1.wrapAsyncAssertionForIterable)(assertActualIsThrowingAsync_1.assertActualIsThrowingAsync)(actual, expected)); }, true() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsTrue_1.assertActualIsTrue)(actual)); }, truthy() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsTruthy_1.assertActualIsTruthy)(actual)); }, undefined() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsUndefined_1.assertActualIsUndefined)(actual)); } }; }; exports.getCombinedAssertionsForEach = getCombinedAssertionsForEach; const getNegatedCombinedAssertionsForEach = function (actual) { return { anError() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotAnError_1.assertActualIsNotAnError)(actual)); }, anErrorWithMessage(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotAnErrorWithMessage_1.assertActualIsNotAnErrorWithMessage)(actual, expected)); }, atLeast(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotAtLeast_1.assertActualIsNotAtLeast)(actual, expected)); }, atMost(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotAtMost_1.assertActualIsNotAtMost)(actual, expected)); }, aValue() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotAValue_1.assertActualIsNotAValue)(actual)); }, containing(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotContaining_1.assertActualIsNotContaining)(actual, expected)); }, containingAllOf(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotContainingAllOf_1.assertActualIsNotContainingAllOf)(actual, expected)); }, containingAnyOf(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotContainingAnyOf_1.assertActualIsNotContainingAnyOf)(actual, expected)); }, empty() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotEmpty_1.assertActualIsNotEmpty)(actual)); }, endingWith(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotEndingWith_1.assertActualIsNotEndingWithActual)(actual, expected)); }, equalTo(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotEqualTo_1.assertActualIsNotEqualTo)(actual, expected)); }, false() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotFalse_1.assertActualIsNotFalse)(actual)); }, falsy() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotFalsy_1.assertActualIsNotFalsy)(actual)); }, greaterThan(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotGreaterThan_1.assertActualIsNotGreaterThan)(actual, expected)); }, identicalTo(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotIdenticalTo_1.assertActualIsNotIdenticalTo)(actual, expected)); }, instanceOf(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotInstanceOf_1.assertActualIsNotInstanceOf)(actual, expected)); }, lessThan(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotLessThan_1.assertActualIsNotLessThan)(actual, expected)); }, matching(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotMatching_1.assertActualIsNotMatching)(actual, expected)); }, NaN() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotNaN_1.assertActualIsNotNaN)(actual)); }, null() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotNull_1.assertActualIsNotNull)(actual)); }, ofType(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotOfType_1.assertActualIsNotOfType)(actual, expected)); }, sameJsonAs(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotSameJsonAs_1.assertActualIsNotSameJsonAs)(actual, expected)); }, startingWith(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotStartingWith_1.assertActualIsNotStartingWith)(actual, expected)); }, throwing(expected) { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotThrowing_1.assertActualIsNotThrowing)(actual, expected)); }, async throwingAsync(expected) { (0, report_1.report)(await (0, wrapAssertionForIterable_1.wrapAsyncAssertionForIterable)(assertActualIsNotThrowingAsync_1.assertActualIsNotThrowingAsync)(actual, expected)); }, true() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotTrue_1.assertActualIsNotTrue)(actual)); }, truthy() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotTruthy_1.assertActualIsNotTruthy)(actual)); }, undefined() { (0, report_1.report)((0, wrapAssertionForIterable_1.wrapAssertionForIterable)(assertActualIsNotUndefined_1.assertActualIsNotUndefined)(actual)); } }; }; exports.getNegatedCombinedAssertionsForEach = getNegatedCombinedAssertionsForEach;