diff --git a/LICENSE.txt b/LICENSE.txt index fb7f701..c243459 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,5 +1,5 @@ The MIT License (MIT) -Copyright (c) 2011-2021 the native web. All rights reserved. +Copyright (c) 2011-2022 the native web. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index bdd83da..e7e2db0 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,20 @@ assert.that(actual).is.containingAnyOf([ 'native', 'web' ]); assert.that(actual).is.containingAllOf([ 'native', 'web' ]); ``` +## Asserting on the contents of arrays, sets, and maps + +It is possible to run the same assertion on all values in an array, set, or map: + +```javascript +assert.that.eachElementOf(arrayOfStrings).is.startingWith('foo'); + +assert.that.eachElementOf(setOfObjects).is.atLeast({ foo: 'bar' }); + +assert.that.eachElementOf(mapOfThings).is.not.null(); +``` + +While the `.eachElementOf(...).is...` assertions run the assertion on each item of arrays and sets, it runs the assertions only on the values of maps. + ## Caveats Most assertions build upon an internal comparison using a diff-algorithm. To avoid infinite recursion, all asserted values are first dispelled (i.e. recursions in them are detected and removed). These recursions can in principle be compared by value across arrays and objects. However, this does not work with `Set`s and `Map`s, since a `Map` can have reference types as keys and the element in `Set` can not be uniquely identified in a reproducible way. So comparisons of `Set`s and `Map`s that contain recursions might not work as expected. diff --git a/lib/assertions/combined/CombinedAssertions.ts b/lib/assertions/combined/CombinedAssertions.ts new file mode 100644 index 0000000..33fbb94 --- /dev/null +++ b/lib/assertions/combined/CombinedAssertions.ts @@ -0,0 +1,26 @@ +import { ArrayAssertions } from '../forArrays/ArrayAssertions'; +import { CommonAssertions } from '../forAny/CommonAssertions'; +import { FunctionAssertions } from '../forFunctions/FunctionAssertions'; +import { MapAssertions } from '../forMaps/MapAssertions'; +import { NumberAssertions } from '../forNumbers/NumberAssertions'; +import { ObjectAssertions } from '../forObjects/ObjectAssertions'; +import { Result } from 'defekt'; +import { ResultAssertions } from '../forResults/ResultAssertions'; +import { SetAssertions } from '../forSets/SetAssertions'; +import { StringAssertions } from '../forStrings/StringAssertions'; + +type CombinedAssertions = + CommonAssertions & + (TValue extends Set ? SetAssertions : + TValue extends Map ? MapAssertions : + TValue extends (infer TContent)[] ? ArrayAssertions : + TValue extends Result ? ResultAssertions : + TValue extends number ? NumberAssertions : + TValue extends string ? StringAssertions : + TValue extends (...args: any[]) => any ? FunctionAssertions : + TValue extends object ? ObjectAssertions : + CommonAssertions); + +export type { + CombinedAssertions +}; diff --git a/lib/assertions/combined/assertActualIsAValue.ts b/lib/assertions/combined/assertActualIsAValue.ts new file mode 100644 index 0000000..5211184 --- /dev/null +++ b/lib/assertions/combined/assertActualIsAValue.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertResultIsAValue } from '../forResults/assertResultIsAValue'; +import { Result } from 'defekt'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const assertActualIsAValue = function ( + actual: Result +): Result { + return assertResultIsAValue(actual); +}; + +export { + assertActualIsAValue +}; diff --git a/lib/assertions/combined/assertActualIsAnError.ts b/lib/assertions/combined/assertActualIsAnError.ts new file mode 100644 index 0000000..826b6eb --- /dev/null +++ b/lib/assertions/combined/assertActualIsAnError.ts @@ -0,0 +1,13 @@ +import { AssertionFailed } from '../../errors'; +import { assertResultIsAnError } from '../forResults/assertResultIsAnError'; +import { Result } from 'defekt'; + +const assertActualIsAnError = function ( + actual: Result +): Result { + return assertResultIsAnError(actual); +}; + +export { + assertActualIsAnError +}; diff --git a/lib/assertions/combined/assertActualIsAnErrorWithMessage.ts b/lib/assertions/combined/assertActualIsAnErrorWithMessage.ts new file mode 100644 index 0000000..422c4de --- /dev/null +++ b/lib/assertions/combined/assertActualIsAnErrorWithMessage.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertResultIsAnErrorWithMessage } from '../forResults/assertResultIsAnErrorWithMessage'; +import { Result } from 'defekt'; + +const assertActualIsAnErrorWithMessage = function ( + actual: Result, + expected: string +): Result { + return assertResultIsAnErrorWithMessage(actual, expected); +}; + +export { + assertActualIsAnErrorWithMessage +}; diff --git a/lib/assertions/combined/assertActualIsAtLeast.ts b/lib/assertions/combined/assertActualIsAtLeast.ts new file mode 100644 index 0000000..13852d4 --- /dev/null +++ b/lib/assertions/combined/assertActualIsAtLeast.ts @@ -0,0 +1,32 @@ +import { assertMapIsAtLeastMap } from '../forMaps/assertMapIsAtLeastMap'; +import { assertNumberIsAtLeastNumber } from '../forNumbers/assertNumberIsAtLeastNumber'; +import { assertObjectIsAtLeastObject } from '../forObjects/assertObjectIsAtLeastObject'; +import { assertSetIsAtLeastSet } from '../forSets/assertSetIsAtLeastSet'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../errors'; +import { isMap, isNumber, isObject, isSet } from 'typedescriptor'; + +const assertActualIsAtLeast = function ( + actual: Map | number | Set | object, + expected: Map | number | Set | object +): Result { + if (isMap(actual) && isMap(expected)) { + return assertMapIsAtLeastMap(actual, expected); + } + if (isNumber(actual) && isNumber(expected)) { + return assertNumberIsAtLeastNumber(actual, expected); + } + if (isSet(actual) && isSet(expected)) { + return assertSetIsAtLeastSet(actual, expected); + } + if (isObject(actual) && isObject(expected)) { + return assertObjectIsAtLeastObject(actual, expected); + } + + throw new InvalidOperation(); +}; + +export { + assertActualIsAtLeast +}; + diff --git a/lib/assertions/combined/assertActualIsAtMost.ts b/lib/assertions/combined/assertActualIsAtMost.ts new file mode 100644 index 0000000..69526e0 --- /dev/null +++ b/lib/assertions/combined/assertActualIsAtMost.ts @@ -0,0 +1,31 @@ +import { assertMapIsAtMostMap } from '../forMaps/assertMapIsAtMostMap'; +import { assertNumberIsAtMostNumber } from '../forNumbers/assertNumberIsAtMostNumber'; +import { assertObjectIsAtMostObject } from '../forObjects/assertObjectIsAtMostObject'; +import { assertSetIsAtMostSet } from '../forSets/assertSetIsAtMostSet'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../errors'; +import { isMap, isNumber, isObject, isSet } from 'typedescriptor'; + +const assertActualIsAtMost = function ( + actual: Map | number | Set | object, + expected: Map | number | Set | object +): Result { + if (isMap(actual) && isMap(expected)) { + return assertMapIsAtMostMap(actual, expected); + } + if (isNumber(actual) && isNumber(expected)) { + return assertNumberIsAtMostNumber(actual, expected); + } + if (isSet(actual) && isSet(expected)) { + return assertSetIsAtMostSet(actual, expected); + } + if (isObject(actual) && isObject(expected)) { + return assertObjectIsAtMostObject(actual, expected); + } + + throw new InvalidOperation(); +}; + +export { + assertActualIsAtMost +}; diff --git a/lib/assertions/combined/assertActualIsContaining.ts b/lib/assertions/combined/assertActualIsContaining.ts new file mode 100644 index 0000000..40613dc --- /dev/null +++ b/lib/assertions/combined/assertActualIsContaining.ts @@ -0,0 +1,26 @@ +import { assertArrayIsContainingItem } from '../forArrays/assertArrayIsContainingItem'; +import { assertSetIsContainingItem } from '../forSets/assertSetIsContainingItem'; +import { assertStringIsContainingString } from '../forStrings/assertStringIsContainingString'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../errors'; +import { isArray, isSet, isString } from 'typedescriptor'; + +const assertActualIsContaining = function ( + actual: string | TContent[] | Set, + expected: string | TContent +): Result { + if (isString(actual)) { + return assertStringIsContainingString(actual, expected as string); + } + if (isArray(actual)) { + return assertArrayIsContainingItem(actual, expected); + } + if (isSet(actual)) { + return assertSetIsContainingItem(actual, expected); + } + throw new InvalidOperation(); +}; + +export { + assertActualIsContaining +}; diff --git a/lib/assertions/combined/assertActualIsContainingAllOf.ts b/lib/assertions/combined/assertActualIsContainingAllOf.ts new file mode 100644 index 0000000..cc46ddf --- /dev/null +++ b/lib/assertions/combined/assertActualIsContainingAllOf.ts @@ -0,0 +1,26 @@ +import { assertArrayIsContainingAllOfIterable } from '../forArrays/assertArrayIsContainingAllOfIterable'; +import { assertSetIsContainingAllOfIterable } from '../forSets/assertSetIsContainingAllOfIterable'; +import { assertStringIsContainingAllOfIterable } from '../forStrings/assertStringIsContainingAllOfIterable'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../errors'; +import { isArray, isSet, isString } from 'typedescriptor'; + +const assertActualIsContainingAllOf = function ( + actual: string | TContent[] | Set, + expected: (string | TContent)[] +): Result { + if (isString(actual)) { + return assertStringIsContainingAllOfIterable(actual, expected as string[]); + } + if (isArray(actual)) { + return assertArrayIsContainingAllOfIterable(actual, expected); + } + if (isSet(actual)) { + return assertSetIsContainingAllOfIterable(actual, expected); + } + throw new InvalidOperation(); +}; + +export { + assertActualIsContainingAllOf +}; diff --git a/lib/assertions/combined/assertActualIsContainingAnyOf.ts b/lib/assertions/combined/assertActualIsContainingAnyOf.ts new file mode 100644 index 0000000..41b5550 --- /dev/null +++ b/lib/assertions/combined/assertActualIsContainingAnyOf.ts @@ -0,0 +1,26 @@ +import { assertArrayIsContainingAnyOfIterable } from '../forArrays/assertArrayIsContainingAnyOfIterable'; +import { assertSetIsContainingAnyOfIterable } from '../forSets/assertSetIsContainingAnyOfIterable'; +import { assertStringIsContainingAnyOfIterable } from '../forStrings/assertStringIsContainingAnyOfIterable'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../errors'; +import { isArray, isSet, isString } from 'typedescriptor'; + +const assertActualIsContainingAnyOf = function ( + actual: string | TContent[] | Set, + expected: (string | TContent)[] +): Result { + if (isString(actual)) { + return assertStringIsContainingAnyOfIterable(actual, expected as string[]); + } + if (isArray(actual)) { + return assertArrayIsContainingAnyOfIterable(actual, expected); + } + if (isSet(actual)) { + return assertSetIsContainingAnyOfIterable(actual, expected); + } + throw new InvalidOperation(); +}; + +export { + assertActualIsContainingAnyOf +}; diff --git a/lib/assertions/combined/assertActualIsEmpty.ts b/lib/assertions/combined/assertActualIsEmpty.ts new file mode 100644 index 0000000..1178673 --- /dev/null +++ b/lib/assertions/combined/assertActualIsEmpty.ts @@ -0,0 +1,34 @@ +import { assertArrayIsEmpty } from '../forArrays/assertArrayIsEmpty'; +import { assertMapIsEmpty } from '../forMaps/assertMapIsEmpty'; +import { assertObjectIsEmpty } from '../forObjects/assertObjectIsEmpty'; +import { assertSetIsEmpty } from '../forSets/assertSetIsEmpty'; +import { assertStringIsEmpty } from '../forStrings/assertStringIsEmpty'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../errors'; +import { isArray, isMap, isObject, isSet, isString } from 'typedescriptor'; + +const assertActualIsEmpty = function ( + actual: TContent[] | Map | Set | string | object +): Result { + if (isArray(actual)) { + return assertArrayIsEmpty(actual); + } + if (isMap(actual)) { + return assertMapIsEmpty(actual); + } + if (isSet(actual)) { + return assertSetIsEmpty(actual); + } + if (isString(actual)) { + return assertStringIsEmpty(actual); + } + if (isObject(actual)) { + return assertObjectIsEmpty(actual); + } + + throw new InvalidOperation(); +}; + +export { + assertActualIsEmpty +}; diff --git a/lib/assertions/combined/assertActualIsEndingWith.ts b/lib/assertions/combined/assertActualIsEndingWith.ts new file mode 100644 index 0000000..12fd751 --- /dev/null +++ b/lib/assertions/combined/assertActualIsEndingWith.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertStringIsEndingWithString } from '../forStrings/assertStringIsEndingWithString'; +import { Result } from 'defekt'; + +const assertActualIsEndingWithActual = function ( + actual: string, + expected: string +): Result { + return assertStringIsEndingWithString(actual, expected); +}; + +export { + assertActualIsEndingWithActual +}; diff --git a/lib/assertions/combined/assertActualIsEqualTo.ts b/lib/assertions/combined/assertActualIsEqualTo.ts new file mode 100644 index 0000000..31be5d0 --- /dev/null +++ b/lib/assertions/combined/assertActualIsEqualTo.ts @@ -0,0 +1,14 @@ +import { assertAnyIsEqualToExpected } from '../forAny/assertAnyIsEqualToExpected'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsEqualTo = function ( + actual: any, + expected: any +): Result { + return assertAnyIsEqualToExpected(actual, expected); +}; + +export { + assertActualIsEqualTo +}; diff --git a/lib/assertions/combined/assertActualIsFalse.ts b/lib/assertions/combined/assertActualIsFalse.ts new file mode 100644 index 0000000..98d3c03 --- /dev/null +++ b/lib/assertions/combined/assertActualIsFalse.ts @@ -0,0 +1,13 @@ +import { assertAnyIsFalse } from '../forAny/assertAnyIsFalse'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsFalse = function ( + actual: any +): Result { + return assertAnyIsFalse(actual); +}; + +export { + assertActualIsFalse +}; diff --git a/lib/assertions/combined/assertActualIsFalsy.ts b/lib/assertions/combined/assertActualIsFalsy.ts new file mode 100644 index 0000000..afa4f24 --- /dev/null +++ b/lib/assertions/combined/assertActualIsFalsy.ts @@ -0,0 +1,13 @@ +import { assertAnyIsFalsy } from '../forAny/assertAnyIsFalsy'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsFalsy = function ( + actual: any +): Result { + return assertAnyIsFalsy(actual); +}; + +export { + assertActualIsFalsy +}; diff --git a/lib/assertions/combined/assertActualIsGreaterThan.ts b/lib/assertions/combined/assertActualIsGreaterThan.ts new file mode 100644 index 0000000..45ef7a5 --- /dev/null +++ b/lib/assertions/combined/assertActualIsGreaterThan.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertNumberIsGreaterThanNumber } from '../forNumbers/assertNumberIsGreaterThanNumber'; +import { Result } from 'defekt'; + +const assertActualIsGreaterThan = function ( + actual: number, + expected: number +): Result { + return assertNumberIsGreaterThanNumber(actual, expected); +}; + +export { + assertActualIsGreaterThan +}; diff --git a/lib/assertions/combined/assertActualIsIdenticalTo.ts b/lib/assertions/combined/assertActualIsIdenticalTo.ts new file mode 100644 index 0000000..5c3c1ef --- /dev/null +++ b/lib/assertions/combined/assertActualIsIdenticalTo.ts @@ -0,0 +1,14 @@ +import { assertAnyIsIdenticalToExpected } from '../forAny/assertAnyIsIdenticalToExpected'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsIdenticalTo = function ( + actual: any, + expected: any +): Result { + return assertAnyIsIdenticalToExpected(actual, expected); +}; + +export { + assertActualIsIdenticalTo +}; diff --git a/lib/assertions/combined/assertActualIsInstanceOf.ts b/lib/assertions/combined/assertActualIsInstanceOf.ts new file mode 100644 index 0000000..9103727 --- /dev/null +++ b/lib/assertions/combined/assertActualIsInstanceOf.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertObjectIsInstanceOfClass } from '../forObjects/assertObjectIsInstanceOfClass'; +import { Result } from 'defekt'; + +const assertActualIsInstanceOf = function ( + actual: object, + expected: (...args: any[]) => any +): Result { + return assertObjectIsInstanceOfClass(actual, expected); +}; + +export { + assertActualIsInstanceOf +}; diff --git a/lib/assertions/combined/assertActualIsLessThan.ts b/lib/assertions/combined/assertActualIsLessThan.ts new file mode 100644 index 0000000..37c84a3 --- /dev/null +++ b/lib/assertions/combined/assertActualIsLessThan.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertNumberIsLessThanNumber } from '../forNumbers/assertNumberIsLessThanNumber'; +import { Result } from 'defekt'; + +const assertActualIsLessThan = function ( + actual: number, + expected: number +): Result { + return assertNumberIsLessThanNumber(actual, expected); +}; + +export { + assertActualIsLessThan +}; diff --git a/lib/assertions/combined/assertActualIsMatching.ts b/lib/assertions/combined/assertActualIsMatching.ts new file mode 100644 index 0000000..5891c4f --- /dev/null +++ b/lib/assertions/combined/assertActualIsMatching.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertStringIsMatchingRegExp } from '../forStrings/assertStringIsMatchingRegExp'; +import { Result } from 'defekt'; + +const assertActualIsMatching = function ( + actual: string, + expected: RegExp +): Result { + return assertStringIsMatchingRegExp(actual, expected); +}; + +export { + assertActualIsMatching +}; diff --git a/lib/assertions/combined/assertActualIsNaN.ts b/lib/assertions/combined/assertActualIsNaN.ts new file mode 100644 index 0000000..300a681 --- /dev/null +++ b/lib/assertions/combined/assertActualIsNaN.ts @@ -0,0 +1,13 @@ +import { AssertionFailed } from '../../errors'; +import { assertNumberIsNaN } from '../forNumbers/assertNumberIsNaN'; +import { Result } from 'defekt'; + +const assertActualIsNaN = function ( + actual: number +): Result { + return assertNumberIsNaN(actual); +}; + +export { + assertActualIsNaN +}; diff --git a/lib/assertions/combined/assertActualIsNull.ts b/lib/assertions/combined/assertActualIsNull.ts new file mode 100644 index 0000000..0fd9031 --- /dev/null +++ b/lib/assertions/combined/assertActualIsNull.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNull } from '../forAny/assertAnyIsNull'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNull = function ( + actual: any +): Result { + return assertAnyIsNull(actual); +}; + +export { + assertActualIsNull +}; diff --git a/lib/assertions/combined/assertActualIsOfType.ts b/lib/assertions/combined/assertActualIsOfType.ts new file mode 100644 index 0000000..f21cfa6 --- /dev/null +++ b/lib/assertions/combined/assertActualIsOfType.ts @@ -0,0 +1,15 @@ +import { assertAnyIsOfType } from '../forAny/assertAnyIsOfType'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; +import { Type } from 'typedescriptor'; + +const assertActualIsOfType = function ( + actual: any, + expected: Type | 'result' +): Result { + return assertAnyIsOfType(actual, expected); +}; + +export { + assertActualIsOfType +}; diff --git a/lib/assertions/combined/assertActualIsSameJsonAs.ts b/lib/assertions/combined/assertActualIsSameJsonAs.ts new file mode 100644 index 0000000..79bf146 --- /dev/null +++ b/lib/assertions/combined/assertActualIsSameJsonAs.ts @@ -0,0 +1,14 @@ +import { assertAnyIsSameJsonAsExpected } from '../forAny/assertAnyIsSameJsonAsExpected'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsSameJsonAs = function ( + actual: any, + expected: any +): Result { + return assertAnyIsSameJsonAsExpected(actual, expected); +}; + +export { + assertActualIsSameJsonAs +}; diff --git a/lib/assertions/combined/assertActualIsStartingWith.ts b/lib/assertions/combined/assertActualIsStartingWith.ts new file mode 100644 index 0000000..82207a3 --- /dev/null +++ b/lib/assertions/combined/assertActualIsStartingWith.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../errors'; +import { assertStringIsStartingWithString } from '../forStrings/assertStringIsStartingWithString'; +import { Result } from 'defekt'; + +const assertActualIsStartingWith = function ( + actual: string, + expected: string +): Result { + return assertStringIsStartingWithString(actual, expected); +}; + +export { + assertActualIsStartingWith +}; diff --git a/lib/assertions/combined/assertActualIsThrowing.ts b/lib/assertions/combined/assertActualIsThrowing.ts new file mode 100644 index 0000000..743af50 --- /dev/null +++ b/lib/assertions/combined/assertActualIsThrowing.ts @@ -0,0 +1,14 @@ +import { assertFunctionIsThrowing } from '../forFunctions/assertFunctionIsThrowing'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsThrowing = function ( + actual: (...args: any[]) => any, + expected?: string | RegExp | ((ex: TError) => boolean) +): Result { + return assertFunctionIsThrowing(actual, expected); +}; + +export { + assertActualIsThrowing +}; diff --git a/lib/assertions/combined/assertActualIsThrowingAsync.ts b/lib/assertions/combined/assertActualIsThrowingAsync.ts new file mode 100644 index 0000000..510a0b7 --- /dev/null +++ b/lib/assertions/combined/assertActualIsThrowingAsync.ts @@ -0,0 +1,14 @@ +import { assertFunctionIsThrowingAsync } from '../forFunctions/assertFunctionIsThrowingAsync'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsThrowingAsync = async function ( + actual: (...args: any[]) => any, + expected?: string | RegExp | ((ex: TError) => boolean) +): Promise> { + return assertFunctionIsThrowingAsync(actual, expected); +}; + +export { + assertActualIsThrowingAsync +}; diff --git a/lib/assertions/combined/assertActualIsTrue.ts b/lib/assertions/combined/assertActualIsTrue.ts new file mode 100644 index 0000000..3613fdc --- /dev/null +++ b/lib/assertions/combined/assertActualIsTrue.ts @@ -0,0 +1,13 @@ +import { assertAnyIsTrue } from '../forAny/assertAnyIsTrue'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsTrue = function ( + actual: any +): Result { + return assertAnyIsTrue(actual); +}; + +export { + assertActualIsTrue +}; diff --git a/lib/assertions/combined/assertActualIsTruthy.ts b/lib/assertions/combined/assertActualIsTruthy.ts new file mode 100644 index 0000000..fb561c0 --- /dev/null +++ b/lib/assertions/combined/assertActualIsTruthy.ts @@ -0,0 +1,13 @@ +import { assertAnyIsTruthy } from '../forAny/assertAnyIsTruthy'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsTruthy = function ( + actual: any +): Result { + return assertAnyIsTruthy(actual); +}; + +export { + assertActualIsTruthy +}; diff --git a/lib/assertions/combined/assertActualIsUndefined.ts b/lib/assertions/combined/assertActualIsUndefined.ts new file mode 100644 index 0000000..6d61760 --- /dev/null +++ b/lib/assertions/combined/assertActualIsUndefined.ts @@ -0,0 +1,13 @@ +import { assertAnyIsUndefined } from '../forAny/assertAnyIsUndefined'; +import { AssertionFailed } from '../../errors'; +import { Result } from 'defekt'; + +const assertActualIsUndefined = function ( + actual: any +): Result { + return assertAnyIsUndefined(actual); +}; + +export { + assertActualIsUndefined +}; diff --git a/lib/assertions/combined/assertions.ts b/lib/assertions/combined/assertions.ts new file mode 100644 index 0000000..0462ce4 --- /dev/null +++ b/lib/assertions/combined/assertions.ts @@ -0,0 +1,423 @@ +import { assertActualIsAnError } from './assertActualIsAnError'; +import { assertActualIsAnErrorWithMessage } from './assertActualIsAnErrorWithMessage'; +import { assertActualIsAtLeast } from './assertActualIsAtLeast'; +import { assertActualIsAtMost } from './assertActualIsAtMost'; +import { assertActualIsAValue } from './assertActualIsAValue'; +import { assertActualIsContaining } from './assertActualIsContaining'; +import { assertActualIsContainingAllOf } from './assertActualIsContainingAllOf'; +import { assertActualIsContainingAnyOf } from './assertActualIsContainingAnyOf'; +import { assertActualIsEmpty } from './assertActualIsEmpty'; +import { assertActualIsEndingWithActual } from './assertActualIsEndingWith'; +import { assertActualIsEqualTo } from './assertActualIsEqualTo'; +import { assertActualIsFalse } from './assertActualIsFalse'; +import { assertActualIsFalsy } from './assertActualIsFalsy'; +import { assertActualIsGreaterThan } from './assertActualIsGreaterThan'; +import { assertActualIsIdenticalTo } from './assertActualIsIdenticalTo'; +import { assertActualIsInstanceOf } from './assertActualIsInstanceOf'; +import { assertActualIsLessThan } from './assertActualIsLessThan'; +import { assertActualIsMatching } from './assertActualIsMatching'; +import { assertActualIsNaN } from './assertActualIsNaN'; +import { assertActualIsNotAnError } from './negated/assertActualIsNotAnError'; +import { assertActualIsNotAnErrorWithMessage } from './negated/assertActualIsNotAnErrorWithMessage'; +import { assertActualIsNotAtLeast } from './negated/assertActualIsNotAtLeast'; +import { assertActualIsNotAtMost } from './negated/assertActualIsNotAtMost'; +import { assertActualIsNotAValue } from './negated/assertActualIsNotAValue'; +import { assertActualIsNotContaining } from './negated/assertActualIsNotContaining'; +import { assertActualIsNotContainingAllOf } from './negated/assertActualIsNotContainingAllOf'; +import { assertActualIsNotContainingAnyOf } from './negated/assertActualIsNotContainingAnyOf'; +import { assertActualIsNotEmpty } from './negated/assertActualIsNotEmpty'; +import { assertActualIsNotEndingWithActual } from './negated/assertActualIsNotEndingWith'; +import { assertActualIsNotEqualTo } from './negated/assertActualIsNotEqualTo'; +import { assertActualIsNotFalse } from './negated/assertActualIsNotFalse'; +import { assertActualIsNotFalsy } from './negated/assertActualIsNotFalsy'; +import { assertActualIsNotGreaterThan } from './negated/assertActualIsNotGreaterThan'; +import { assertActualIsNotIdenticalTo } from './negated/assertActualIsNotIdenticalTo'; +import { assertActualIsNotInstanceOf } from './negated/assertActualIsNotInstanceOf'; +import { assertActualIsNotLessThan } from './negated/assertActualIsNotLessThan'; +import { assertActualIsNotMatching } from './negated/assertActualIsNotMatching'; +import { assertActualIsNotNaN } from './negated/assertActualIsNotNaN'; +import { assertActualIsNotNull } from './negated/assertActualIsNotNull'; +import { assertActualIsNotOfType } from './negated/assertActualIsNotOfType'; +import { assertActualIsNotSameJsonAs } from './negated/assertActualIsNotSameJsonAs'; +import { assertActualIsNotStartingWith } from './negated/assertActualIsNotStartingWith'; +import { assertActualIsNotThrowing } from './negated/assertActualIsNotThrowing'; +import { assertActualIsNotThrowingAsync } from './negated/assertActualIsNotThrowingAsync'; +import { assertActualIsNotTrue } from './negated/assertActualIsNotTrue'; +import { assertActualIsNotTruthy } from './negated/assertActualIsNotTruthy'; +import { assertActualIsNotUndefined } from './negated/assertActualIsNotUndefined'; +import { assertActualIsNull } from './assertActualIsNull'; +import { assertActualIsOfType } from './assertActualIsOfType'; +import { assertActualIsSameJsonAs } from './assertActualIsSameJsonAs'; +import { assertActualIsStartingWith } from './assertActualIsStartingWith'; +import { assertActualIsThrowing } from './assertActualIsThrowing'; +import { assertActualIsThrowingAsync } from './assertActualIsThrowingAsync'; +import { assertActualIsTrue } from './assertActualIsTrue'; +import { assertActualIsTruthy } from './assertActualIsTruthy'; +import { assertActualIsUndefined } from './assertActualIsUndefined'; +import { CombinedAssertions } from './CombinedAssertions'; +import { report } from '../../report'; +import { Type } from 'typedescriptor'; +import { wrapAssertionForIterable, wrapAsyncAssertionForIterable } from '../../wrapAssertionForIterable'; + +const getCombinedAssertions = function (actual: TAny): CombinedAssertions { + return { + anError (): void { + report(assertActualIsAnError(actual as any)); + }, + anErrorWithMessage (expected: string): void { + report(assertActualIsAnErrorWithMessage(actual as any, expected)); + }, + atLeast (expected: Map | number | Set | object): void { + report(assertActualIsAtLeast(actual as any, expected)); + }, + atMost (expected: Map | number | Set | object): void { + report(assertActualIsAtMost(actual as any, expected)); + }, + aValue (): void { + report(assertActualIsAValue(actual as any)); + }, + containing (expected: string): void { + report(assertActualIsContaining(actual as any, expected)); + }, + containingAllOf (expected: string[]): void { + report(assertActualIsContainingAllOf(actual as any, expected)); + }, + containingAnyOf (expected: string[]): void { + report(assertActualIsContainingAnyOf(actual as any, expected)); + }, + empty (): void { + report(assertActualIsEmpty(actual as any)); + }, + endingWith (expected: string): void { + report(assertActualIsEndingWithActual(actual as any, expected)); + }, + equalTo (expected: TAny): void { + report(assertActualIsEqualTo(actual, expected)); + }, + false (): void { + report(assertActualIsFalse(actual as any)); + }, + falsy (): void { + report(assertActualIsFalsy(actual as any)); + }, + greaterThan (expected: number): void { + report(assertActualIsGreaterThan(actual as any, expected)); + }, + identicalTo (expected: TAny): void { + report(assertActualIsIdenticalTo(actual, expected)); + }, + instanceOf (expected: (...args: any[]) => any): void { + report(assertActualIsInstanceOf(actual as any, expected)); + }, + lessThan (expected: number): void { + report(assertActualIsLessThan(actual as any, expected)); + }, + matching (expected: RegExp): void { + report(assertActualIsMatching(actual as any, expected)); + }, + NaN (): void { + report(assertActualIsNaN(actual as any)); + }, + null (): void { + report(assertActualIsNull(actual as any)); + }, + ofType (expected: Type | 'result'): void { + report(assertActualIsOfType(actual as any, expected)); + }, + sameJsonAs (expected: any): void { + report(assertActualIsSameJsonAs(actual, expected)); + }, + startingWith (expected: string): void { + report(assertActualIsStartingWith(actual as any, expected)); + }, + throwing (expected?: string | RegExp | ((ex: Error) => boolean)): void { + report(assertActualIsThrowing(actual as any, expected)); + }, + async throwingAsync (expected?: string | RegExp | ((ex: Error) => boolean)): Promise { + report(await assertActualIsThrowingAsync(actual as any, expected)); + }, + true (): void { + report(assertActualIsTrue(actual as any)); + }, + truthy (): void { + report(assertActualIsTruthy(actual as any)); + }, + undefined (): void { + report(assertActualIsUndefined(actual as any)); + } + } as any; +}; + +const getNegatedCombinedAssertions = function (actual: TAny): CombinedAssertions { + return { + anError (): void { + report(assertActualIsNotAnError(actual as any)); + }, + anErrorWithMessage (expected: string): void { + report(assertActualIsNotAnErrorWithMessage(actual as any, expected)); + }, + atLeast (expected: Map | number | Set | object): void { + report(assertActualIsNotAtLeast(actual as any, expected)); + }, + atMost (expected: Map | number | Set | object): void { + report(assertActualIsNotAtMost(actual as any, expected)); + }, + aValue (): void { + report(assertActualIsNotAValue(actual as any)); + }, + containing (expected: string): void { + report(assertActualIsNotContaining(actual as any, expected)); + }, + containingAllOf (expected: string[]): void { + report(assertActualIsNotContainingAllOf(actual as any, expected)); + }, + containingAnyOf (expected: string[]): void { + report(assertActualIsNotContainingAnyOf(actual as any, expected)); + }, + empty (): void { + report(assertActualIsNotEmpty(actual as any)); + }, + endingWith (expected: string): void { + report(assertActualIsNotEndingWithActual(actual as any, expected)); + }, + equalTo (expected: TAny): void { + report(assertActualIsNotEqualTo(actual, expected)); + }, + false (): void { + report(assertActualIsNotFalse(actual as any)); + }, + falsy (): void { + report(assertActualIsNotFalsy(actual as any)); + }, + greaterThan (expected: number): void { + report(assertActualIsNotGreaterThan(actual as any, expected)); + }, + identicalTo (expected: TAny): void { + report(assertActualIsNotIdenticalTo(actual, expected)); + }, + instanceOf (expected: (...args: any[]) => any): void { + report(assertActualIsNotInstanceOf(actual as any, expected)); + }, + lessThan (expected: number): void { + report(assertActualIsNotLessThan(actual as any, expected)); + }, + matching (expected: RegExp): void { + report(assertActualIsNotMatching(actual as any, expected)); + }, + NaN (): void { + report(assertActualIsNotNaN(actual as any)); + }, + null (): void { + report(assertActualIsNotNull(actual as any)); + }, + ofType (expected: Type | 'result'): void { + report(assertActualIsNotOfType(actual as any, expected)); + }, + sameJsonAs (expected: any): void { + report(assertActualIsNotSameJsonAs(actual, expected)); + }, + startingWith (expected: string): void { + report(assertActualIsNotStartingWith(actual as any, expected)); + }, + throwing (expected?: string | RegExp | ((ex: Error) => boolean)): void { + report(assertActualIsNotThrowing(actual as any, expected)); + }, + async throwingAsync (expected?: string | RegExp | ((ex: Error) => boolean)): Promise { + report(await assertActualIsNotThrowingAsync(actual as any, expected)); + }, + true (): void { + report(assertActualIsNotTrue(actual as any)); + }, + truthy (): void { + report(assertActualIsNotTruthy(actual as any)); + }, + undefined (): void { + report(assertActualIsNotUndefined(actual as any)); + } + } as any; +}; + +const getCombinedAssertionsForEach = function (actual: TAny): CombinedAssertions { + return { + anError (): void { + report(wrapAssertionForIterable(assertActualIsAnError)(actual as any)); + }, + anErrorWithMessage (expected: string): void { + report(wrapAssertionForIterable(assertActualIsAnErrorWithMessage)(actual as any, expected)); + }, + atLeast (expected: Map | number | Set | object): void { + report(wrapAssertionForIterable(assertActualIsAtLeast)(actual as any, expected)); + }, + atMost (expected: Map | number | Set | object): void { + report(wrapAssertionForIterable(assertActualIsAtMost)(actual as any, expected)); + }, + aValue (): void { + report(wrapAssertionForIterable(assertActualIsAValue)(actual as any)); + }, + containing (expected: string): void { + report(wrapAssertionForIterable(assertActualIsContaining)(actual as any, expected)); + }, + containingAllOf (expected: string[]): void { + report(wrapAssertionForIterable(assertActualIsContainingAllOf)(actual as any, expected)); + }, + containingAnyOf (expected: string[]): void { + report(wrapAssertionForIterable(assertActualIsContainingAnyOf)(actual as any, expected)); + }, + empty (): void { + report(wrapAssertionForIterable(assertActualIsEmpty)(actual as any)); + }, + endingWith (expected: string): void { + report(wrapAssertionForIterable(assertActualIsEndingWithActual)(actual as any, expected)); + }, + equalTo (expected: TAny): void { + report(wrapAssertionForIterable(assertActualIsEqualTo)(actual as any, expected)); + }, + false (): void { + report(wrapAssertionForIterable(assertActualIsFalse)(actual as any)); + }, + falsy (): void { + report(wrapAssertionForIterable(assertActualIsFalsy)(actual as any)); + }, + greaterThan (expected: number): void { + report(wrapAssertionForIterable(assertActualIsGreaterThan)(actual as any, expected)); + }, + identicalTo (expected: TAny): void { + report(wrapAssertionForIterable(assertActualIsIdenticalTo)(actual as any, expected)); + }, + instanceOf (expected: (...args: any[]) => any): void { + report(wrapAssertionForIterable(assertActualIsInstanceOf)(actual as any, expected)); + }, + lessThan (expected: number): void { + report(wrapAssertionForIterable(assertActualIsLessThan)(actual as any, expected)); + }, + matching (expected: RegExp): void { + report(wrapAssertionForIterable(assertActualIsMatching)(actual as any, expected)); + }, + NaN (): void { + report(wrapAssertionForIterable(assertActualIsNaN)(actual as any)); + }, + null (): void { + report(wrapAssertionForIterable(assertActualIsNull)(actual as any)); + }, + ofType (expected: Type | 'result'): void { + report(wrapAssertionForIterable(assertActualIsOfType)(actual as any, expected)); + }, + sameJsonAs (expected: any): void { + report(wrapAssertionForIterable(assertActualIsSameJsonAs)(actual as any, expected)); + }, + startingWith (expected: string): void { + report(wrapAssertionForIterable(assertActualIsStartingWith)(actual as any, expected)); + }, + throwing (expected?: string | RegExp | ((ex: Error) => boolean)): void { + report(wrapAssertionForIterable(assertActualIsThrowing)(actual as any, expected)); + }, + async throwingAsync (expected?: string | RegExp | ((ex: Error) => boolean)): Promise { + report(await wrapAsyncAssertionForIterable(assertActualIsThrowingAsync)(actual as any, expected)); + }, + true (): void { + report(wrapAssertionForIterable(assertActualIsTrue)(actual as any)); + }, + truthy (): void { + report(wrapAssertionForIterable(assertActualIsTruthy)(actual as any)); + }, + undefined (): void { + report(wrapAssertionForIterable(assertActualIsUndefined)(actual as any)); + } + } as any; +}; + +const getNegatedCombinedAssertionsForEach = function (actual: TAny): CombinedAssertions { + return { + anError (): void { + report(wrapAssertionForIterable(assertActualIsNotAnError)(actual as any)); + }, + anErrorWithMessage (expected: string): void { + report(wrapAssertionForIterable(assertActualIsNotAnErrorWithMessage)(actual as any, expected)); + }, + atLeast (expected: Map | number | Set | object): void { + report(wrapAssertionForIterable(assertActualIsNotAtLeast)(actual as any, expected)); + }, + atMost (expected: Map | number | Set | object): void { + report(wrapAssertionForIterable(assertActualIsNotAtMost)(actual as any, expected)); + }, + aValue (): void { + report(wrapAssertionForIterable(assertActualIsNotAValue)(actual as any)); + }, + containing (expected: string): void { + report(wrapAssertionForIterable(assertActualIsNotContaining)(actual as any, expected)); + }, + containingAllOf (expected: string[]): void { + report(wrapAssertionForIterable(assertActualIsNotContainingAllOf)(actual as any, expected)); + }, + containingAnyOf (expected: string[]): void { + report(wrapAssertionForIterable(assertActualIsNotContainingAnyOf)(actual as any, expected)); + }, + empty (): void { + report(wrapAssertionForIterable(assertActualIsNotEmpty)(actual as any)); + }, + endingWith (expected: string): void { + report(wrapAssertionForIterable(assertActualIsNotEndingWithActual)(actual as any, expected)); + }, + equalTo (expected: TAny): void { + report(wrapAssertionForIterable(assertActualIsNotEqualTo)(actual as any, expected)); + }, + false (): void { + report(wrapAssertionForIterable(assertActualIsNotFalse)(actual as any)); + }, + falsy (): void { + report(wrapAssertionForIterable(assertActualIsNotFalsy)(actual as any)); + }, + greaterThan (expected: number): void { + report(wrapAssertionForIterable(assertActualIsNotGreaterThan)(actual as any, expected)); + }, + identicalTo (expected: TAny): void { + report(wrapAssertionForIterable(assertActualIsNotIdenticalTo)(actual as any, expected)); + }, + instanceOf (expected: (...args: any[]) => any): void { + report(wrapAssertionForIterable(assertActualIsNotInstanceOf)(actual as any, expected)); + }, + lessThan (expected: number): void { + report(wrapAssertionForIterable(assertActualIsNotLessThan)(actual as any, expected)); + }, + matching (expected: RegExp): void { + report(wrapAssertionForIterable(assertActualIsNotMatching)(actual as any, expected)); + }, + NaN (): void { + report(wrapAssertionForIterable(assertActualIsNotNaN)(actual as any)); + }, + null (): void { + report(wrapAssertionForIterable(assertActualIsNotNull)(actual as any)); + }, + ofType (expected: Type | 'result'): void { + report(wrapAssertionForIterable(assertActualIsNotOfType)(actual as any, expected)); + }, + sameJsonAs (expected: any): void { + report(wrapAssertionForIterable(assertActualIsNotSameJsonAs)(actual as any, expected)); + }, + startingWith (expected: string): void { + report(wrapAssertionForIterable(assertActualIsNotStartingWith)(actual as any, expected)); + }, + throwing (expected?: string | RegExp | ((ex: Error) => boolean)): void { + report(wrapAssertionForIterable(assertActualIsNotThrowing)(actual as any, expected)); + }, + async throwingAsync (expected?: string | RegExp | ((ex: Error) => boolean)): Promise { + report(await wrapAsyncAssertionForIterable(assertActualIsNotThrowingAsync)(actual as any, expected)); + }, + true (): void { + report(wrapAssertionForIterable(assertActualIsNotTrue)(actual as any)); + }, + truthy (): void { + report(wrapAssertionForIterable(assertActualIsNotTruthy)(actual as any)); + }, + undefined (): void { + report(wrapAssertionForIterable(assertActualIsNotUndefined)(actual as any)); + } + } as any; +}; + +export { + getCombinedAssertions, + getNegatedCombinedAssertions, + getCombinedAssertionsForEach, + getNegatedCombinedAssertionsForEach +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotAValue.ts b/lib/assertions/combined/negated/assertActualIsNotAValue.ts new file mode 100644 index 0000000..015eea7 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotAValue.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertResultIsNotAValue } from '../../forResults/assertResultIsNotAValue'; +import { Result } from 'defekt'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +const assertActualIsNotAValue = function ( + actual: Result +): Result { + return assertResultIsNotAValue(actual); +}; + +export { + assertActualIsNotAValue +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotAnError.ts b/lib/assertions/combined/negated/assertActualIsNotAnError.ts new file mode 100644 index 0000000..e0f631a --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotAnError.ts @@ -0,0 +1,13 @@ +import { AssertionFailed } from '../../../errors'; +import { assertResultIsNotAnError } from '../../forResults/assertResultIsNotAnError'; +import { Result } from 'defekt'; + +const assertActualIsNotAnError = function ( + actual: Result +): Result { + return assertResultIsNotAnError(actual); +}; + +export { + assertActualIsNotAnError +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotAnErrorWithMessage.ts b/lib/assertions/combined/negated/assertActualIsNotAnErrorWithMessage.ts new file mode 100644 index 0000000..0078ad2 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotAnErrorWithMessage.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertResultIsNotAnErrorWithMessage } from '../../forResults/assertResultIsNotAnErrorWithMessage'; +import { Result } from 'defekt'; + +const assertActualIsNotAnErrorWithMessage = function ( + actual: Result, + expected: string +): Result { + return assertResultIsNotAnErrorWithMessage(actual, expected); +}; + +export { + assertActualIsNotAnErrorWithMessage +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotAtLeast.ts b/lib/assertions/combined/negated/assertActualIsNotAtLeast.ts new file mode 100644 index 0000000..48dae02 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotAtLeast.ts @@ -0,0 +1,32 @@ +import { assertMapIsNotAtLeastMap } from '../../forMaps/assertMapIsNotAtLeastMap'; +import { assertNumberIsNotAtLeastNumber } from '../../forNumbers/assertNumberIsNotAtLeastNumber'; +import { assertObjectIsNotAtLeastObject } from '../../forObjects/assertObjectIsNotAtLeastObject'; +import { assertSetIsNotAtLeastSet } from '../../forSets/assertSetIsNotAtLeastSet'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../../errors'; +import { isMap, isNumber, isObject, isSet } from 'typedescriptor'; + +const assertActualIsNotAtLeast = function ( + actual: Map | number | Set | object, + expected: Map | number | Set | object +): Result { + if (isMap(actual) && isMap(expected)) { + return assertMapIsNotAtLeastMap(actual, expected); + } + if (isNumber(actual) && isNumber(expected)) { + return assertNumberIsNotAtLeastNumber(actual, expected); + } + if (isSet(actual) && isSet(expected)) { + return assertSetIsNotAtLeastSet(actual, expected); + } + if (isObject(actual) && isObject(expected)) { + return assertObjectIsNotAtLeastObject(actual, expected); + } + + throw new InvalidOperation(); +}; + +export { + assertActualIsNotAtLeast +}; + diff --git a/lib/assertions/combined/negated/assertActualIsNotAtMost.ts b/lib/assertions/combined/negated/assertActualIsNotAtMost.ts new file mode 100644 index 0000000..f1d1aa1 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotAtMost.ts @@ -0,0 +1,31 @@ +import { assertMapIsNotAtMostMap } from '../../forMaps/assertMapIsNotAtMostMap'; +import { assertNumberIsNotAtMostNumber } from '../../forNumbers/assertNumberIsNotAtMostNumber'; +import { assertObjectIsNotAtMostObject } from '../../forObjects/assertObjectIsNotAtMostObject'; +import { assertSetIsNotAtMostSet } from '../../forSets/assertSetIsNotAtMostSet'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../../errors'; +import { isMap, isNumber, isObject, isSet } from 'typedescriptor'; + +const assertActualIsNotAtMost = function ( + actual: Map | number | Set | object, + expected: Map | number | Set | object +): Result { + if (isMap(actual) && isMap(expected)) { + return assertMapIsNotAtMostMap(actual, expected); + } + if (isNumber(actual) && isNumber(expected)) { + return assertNumberIsNotAtMostNumber(actual, expected); + } + if (isSet(actual) && isSet(expected)) { + return assertSetIsNotAtMostSet(actual, expected); + } + if (isObject(actual) && isObject(expected)) { + return assertObjectIsNotAtMostObject(actual, expected); + } + + throw new InvalidOperation(); +}; + +export { + assertActualIsNotAtMost +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotContaining.ts b/lib/assertions/combined/negated/assertActualIsNotContaining.ts new file mode 100644 index 0000000..c8d0121 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotContaining.ts @@ -0,0 +1,26 @@ +import { assertArrayIsNotContainingItem } from '../../forArrays/assertArrayIsNotContainingItem'; +import { assertSetIsNotContainingItem } from '../../forSets/assertSetIsNotContainingItem'; +import { assertStringIsNotContainingString } from '../../forStrings/assertStringIsNotContainingString'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../../errors'; +import { isArray, isSet, isString } from 'typedescriptor'; + +const assertActualIsNotContaining = function ( + actual: string | TContent[] | Set, + expected: string | TContent +): Result { + if (isString(actual)) { + return assertStringIsNotContainingString(actual, expected as string); + } + if (isArray(actual)) { + return assertArrayIsNotContainingItem(actual, expected); + } + if (isSet(actual)) { + return assertSetIsNotContainingItem(actual, expected); + } + throw new InvalidOperation(); +}; + +export { + assertActualIsNotContaining +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotContainingAllOf.ts b/lib/assertions/combined/negated/assertActualIsNotContainingAllOf.ts new file mode 100644 index 0000000..2df5866 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotContainingAllOf.ts @@ -0,0 +1,26 @@ +import { assertArrayIsNotContainingAllOfIterable } from '../../forArrays/assertArrayIsNotContainingAllOfIterable'; +import { assertSetIsNotContainingAllOfIterable } from '../../forSets/assertSetIsNotContainingAllOfIterable'; +import { assertStringIsNotContainingAllOfIterable } from '../../forStrings/assertStringIsNotContainingAllOfIterable'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../../errors'; +import { isArray, isSet, isString } from 'typedescriptor'; + +const assertActualIsNotContainingAllOf = function ( + actual: string | TContent[] | Set, + expected: (string | TContent)[] +): Result { + if (isString(actual)) { + return assertStringIsNotContainingAllOfIterable(actual, expected as string[]); + } + if (isArray(actual)) { + return assertArrayIsNotContainingAllOfIterable(actual, expected); + } + if (isSet(actual)) { + return assertSetIsNotContainingAllOfIterable(actual, expected); + } + throw new InvalidOperation(); +}; + +export { + assertActualIsNotContainingAllOf +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotContainingAnyOf.ts b/lib/assertions/combined/negated/assertActualIsNotContainingAnyOf.ts new file mode 100644 index 0000000..0f2b803 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotContainingAnyOf.ts @@ -0,0 +1,26 @@ +import { assertArrayIsNotContainingAnyOfIterable } from '../../forArrays/assertArrayIsNotContainingAnyOfIterable'; +import { assertSetIsNotContainingAnyOfIterable } from '../../forSets/assertSetIsNotContainingAnyOfIterable'; +import { assertStringIsNotContainingAnyOfIterable } from '../../forStrings/assertStringIsNotContainingAnyOfIterable'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../../errors'; +import { isArray, isSet, isString } from 'typedescriptor'; + +const assertActualIsNotContainingAnyOf = function ( + actual: string | TContent[] | Set, + expected: (string | TContent)[] +): Result { + if (isString(actual)) { + return assertStringIsNotContainingAnyOfIterable(actual, expected as string[]); + } + if (isArray(actual)) { + return assertArrayIsNotContainingAnyOfIterable(actual, expected); + } + if (isSet(actual)) { + return assertSetIsNotContainingAnyOfIterable(actual, expected); + } + throw new InvalidOperation(); +}; + +export { + assertActualIsNotContainingAnyOf +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotEmpty.ts b/lib/assertions/combined/negated/assertActualIsNotEmpty.ts new file mode 100644 index 0000000..35d272c --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotEmpty.ts @@ -0,0 +1,34 @@ +import { assertArrayIsNotEmpty } from '../../forArrays/assertArrayIsNotEmpty'; +import { assertMapIsNotEmpty } from '../../forMaps/assertMapIsNotEmpty'; +import { assertObjectIsNotEmpty } from '../../forObjects/assertObjectIsNotEmpty'; +import { assertSetIsNotEmpty } from '../../forSets/assertSetIsNotEmpty'; +import { assertStringIsNotEmpty } from '../../forStrings/assertStringIsNotEmpty'; +import { Result } from 'defekt'; +import { AssertionFailed, InvalidOperation } from '../../../errors'; +import { isArray, isMap, isObject, isSet, isString } from 'typedescriptor'; + +const assertActualIsNotEmpty = function ( + actual: TContent[] | Map | Set | string | object +): Result { + if (isArray(actual)) { + return assertArrayIsNotEmpty(actual); + } + if (isMap(actual)) { + return assertMapIsNotEmpty(actual); + } + if (isSet(actual)) { + return assertSetIsNotEmpty(actual); + } + if (isString(actual)) { + return assertStringIsNotEmpty(actual); + } + if (isObject(actual)) { + return assertObjectIsNotEmpty(actual); + } + + throw new InvalidOperation(); +}; + +export { + assertActualIsNotEmpty +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotEndingWith.ts b/lib/assertions/combined/negated/assertActualIsNotEndingWith.ts new file mode 100644 index 0000000..a62c050 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotEndingWith.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertStringIsNotEndingWithString } from '../../forStrings/assertStringIsNotEndingWithString'; +import { Result } from 'defekt'; + +const assertActualIsNotEndingWithActual = function ( + actual: string, + expected: string +): Result { + return assertStringIsNotEndingWithString(actual, expected); +}; + +export { + assertActualIsNotEndingWithActual +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotEqualTo.ts b/lib/assertions/combined/negated/assertActualIsNotEqualTo.ts new file mode 100644 index 0000000..bbebad5 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotEqualTo.ts @@ -0,0 +1,14 @@ +import { assertAnyIsNotEqualToExpected } from '../../forAny/assertAnyIsNotEqualToExpected'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotEqualTo = function ( + actual: any, + expected: any +): Result { + return assertAnyIsNotEqualToExpected(actual, expected); +}; + +export { + assertActualIsNotEqualTo +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotFalse.ts b/lib/assertions/combined/negated/assertActualIsNotFalse.ts new file mode 100644 index 0000000..d752f98 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotFalse.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNotFalse } from '../../forAny/assertAnyIsNotFalse'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotFalse = function ( + actual: any +): Result { + return assertAnyIsNotFalse(actual); +}; + +export { + assertActualIsNotFalse +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotFalsy.ts b/lib/assertions/combined/negated/assertActualIsNotFalsy.ts new file mode 100644 index 0000000..40299f2 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotFalsy.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNotFalsy } from '../../forAny/assertAnyIsNotFalsy'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotFalsy = function ( + actual: any +): Result { + return assertAnyIsNotFalsy(actual); +}; + +export { + assertActualIsNotFalsy +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotGreaterThan.ts b/lib/assertions/combined/negated/assertActualIsNotGreaterThan.ts new file mode 100644 index 0000000..653839f --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotGreaterThan.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertNumberIsNotGreaterThanNumber } from '../../forNumbers/assertNumberIsNotGreaterThanNumber'; +import { Result } from 'defekt'; + +const assertActualIsNotGreaterThan = function ( + actual: number, + expected: number +): Result { + return assertNumberIsNotGreaterThanNumber(actual, expected); +}; + +export { + assertActualIsNotGreaterThan +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotIdenticalTo.ts b/lib/assertions/combined/negated/assertActualIsNotIdenticalTo.ts new file mode 100644 index 0000000..12b0c3b --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotIdenticalTo.ts @@ -0,0 +1,14 @@ +import { assertAnyIsNotIdenticalToExpected } from '../../forAny/assertAnyIsNotIdenticalToExpected'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotIdenticalTo = function ( + actual: any, + expected: any +): Result { + return assertAnyIsNotIdenticalToExpected(actual, expected); +}; + +export { + assertActualIsNotIdenticalTo +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotInstanceOf.ts b/lib/assertions/combined/negated/assertActualIsNotInstanceOf.ts new file mode 100644 index 0000000..59bec95 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotInstanceOf.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertObjectIsNotInstanceOfClass } from '../../forObjects/assertObjectIsNotInstanceOfClass'; +import { Result } from 'defekt'; + +const assertActualIsNotInstanceOf = function ( + actual: object, + expected: (...args: any[]) => any +): Result { + return assertObjectIsNotInstanceOfClass(actual, expected); +}; + +export { + assertActualIsNotInstanceOf +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotLessThan.ts b/lib/assertions/combined/negated/assertActualIsNotLessThan.ts new file mode 100644 index 0000000..83ae0d9 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotLessThan.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertNumberIsNotLessThanNumber } from '../../forNumbers/assertNumberIsNotLessThanNumber'; +import { Result } from 'defekt'; + +const assertActualIsNotLessThan = function ( + actual: number, + expected: number +): Result { + return assertNumberIsNotLessThanNumber(actual, expected); +}; + +export { + assertActualIsNotLessThan +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotMatching.ts b/lib/assertions/combined/negated/assertActualIsNotMatching.ts new file mode 100644 index 0000000..107797b --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotMatching.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertStringIsNotMatchingRegExp } from '../../forStrings/assertStringIsNotMatchingRegExp'; +import { Result } from 'defekt'; + +const assertActualIsNotMatching = function ( + actual: string, + expected: RegExp +): Result { + return assertStringIsNotMatchingRegExp(actual, expected); +}; + +export { + assertActualIsNotMatching +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotNaN.ts b/lib/assertions/combined/negated/assertActualIsNotNaN.ts new file mode 100644 index 0000000..4d2672d --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotNaN.ts @@ -0,0 +1,13 @@ +import { AssertionFailed } from '../../../errors'; +import { assertNumberIsNotNaN } from '../../forNumbers/assertNumberIsNotNaN'; +import { Result } from 'defekt'; + +const assertActualIsNotNaN = function ( + actual: number +): Result { + return assertNumberIsNotNaN(actual); +}; + +export { + assertActualIsNotNaN +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotNull.ts b/lib/assertions/combined/negated/assertActualIsNotNull.ts new file mode 100644 index 0000000..94644a7 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotNull.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNotNull } from '../../forAny/assertAnyIsNotNull'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotNull = function ( + actual: any +): Result { + return assertAnyIsNotNull(actual); +}; + +export { + assertActualIsNotNull +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotOfType.ts b/lib/assertions/combined/negated/assertActualIsNotOfType.ts new file mode 100644 index 0000000..04438bc --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotOfType.ts @@ -0,0 +1,15 @@ +import { assertAnyIsNotOfType } from '../../forAny/assertAnyIsNotOfType'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; +import { Type } from 'typedescriptor'; + +const assertActualIsNotOfType = function ( + actual: any, + expected: Type | 'result' +): Result { + return assertAnyIsNotOfType(actual, expected); +}; + +export { + assertActualIsNotOfType +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotSameJsonAs.ts b/lib/assertions/combined/negated/assertActualIsNotSameJsonAs.ts new file mode 100644 index 0000000..2267002 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotSameJsonAs.ts @@ -0,0 +1,14 @@ +import { assertAnyIsNotSameJsonAsExpected } from '../../forAny/assertAnyIsNotSameJsonAsExpected'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotSameJsonAs = function ( + actual: any, + expected: any +): Result { + return assertAnyIsNotSameJsonAsExpected(actual, expected); +}; + +export { + assertActualIsNotSameJsonAs +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotStartingWith.ts b/lib/assertions/combined/negated/assertActualIsNotStartingWith.ts new file mode 100644 index 0000000..0391562 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotStartingWith.ts @@ -0,0 +1,14 @@ +import { AssertionFailed } from '../../../errors'; +import { assertStringIsNotStartingWithString } from '../../forStrings/assertStringIsNotStartingWithString'; +import { Result } from 'defekt'; + +const assertActualIsNotStartingWith = function ( + actual: string, + expected: string +): Result { + return assertStringIsNotStartingWithString(actual, expected); +}; + +export { + assertActualIsNotStartingWith +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotThrowing.ts b/lib/assertions/combined/negated/assertActualIsNotThrowing.ts new file mode 100644 index 0000000..1c5143e --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotThrowing.ts @@ -0,0 +1,14 @@ +import { assertFunctionIsNotThrowing } from '../../forFunctions/assertFunctionIsNotThrowing'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotThrowing = function ( + actual: (...args: any[]) => any, + expected?: string | RegExp | ((ex: TError) => boolean) +): Result { + return assertFunctionIsNotThrowing(actual, expected); +}; + +export { + assertActualIsNotThrowing +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotThrowingAsync.ts b/lib/assertions/combined/negated/assertActualIsNotThrowingAsync.ts new file mode 100644 index 0000000..3f9cac9 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotThrowingAsync.ts @@ -0,0 +1,14 @@ +import { assertFunctionIsNotThrowingAsync } from '../../forFunctions/assertFunctionIsNotThrowingAsync'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotThrowingAsync = async function ( + actual: (...args: any[]) => any, + expected?: string | RegExp | ((ex: TError) => boolean) +): Promise> { + return assertFunctionIsNotThrowingAsync(actual, expected); +}; + +export { + assertActualIsNotThrowingAsync +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotTrue.ts b/lib/assertions/combined/negated/assertActualIsNotTrue.ts new file mode 100644 index 0000000..5d0b591 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotTrue.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNotTrue } from '../../forAny/assertAnyIsNotTrue'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotTrue = function ( + actual: any +): Result { + return assertAnyIsNotTrue(actual); +}; + +export { + assertActualIsNotTrue +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotTruthy.ts b/lib/assertions/combined/negated/assertActualIsNotTruthy.ts new file mode 100644 index 0000000..6348148 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotTruthy.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNotTruthy } from '../../forAny/assertAnyIsNotTruthy'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotTruthy = function ( + actual: any +): Result { + return assertAnyIsNotTruthy(actual); +}; + +export { + assertActualIsNotTruthy +}; diff --git a/lib/assertions/combined/negated/assertActualIsNotUndefined.ts b/lib/assertions/combined/negated/assertActualIsNotUndefined.ts new file mode 100644 index 0000000..17c1e06 --- /dev/null +++ b/lib/assertions/combined/negated/assertActualIsNotUndefined.ts @@ -0,0 +1,13 @@ +import { assertAnyIsNotUndefined } from '../../forAny/assertAnyIsNotUndefined'; +import { AssertionFailed } from '../../../errors'; +import { Result } from 'defekt'; + +const assertActualIsNotUndefined = function ( + actual: any +): Result { + return assertAnyIsNotUndefined(actual); +}; + +export { + assertActualIsNotUndefined +}; diff --git a/lib/assertions/forAny/AssertThatForAny.ts b/lib/assertions/forAny/AssertThatForAny.ts deleted file mode 100644 index fa5ab52..0000000 --- a/lib/assertions/forAny/AssertThatForAny.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CommonAssertions } from './CommonAssertions'; - -type AssertThatForAny = (actual: TAny) => { - is: CommonAssertions & { - not: CommonAssertions; - }; -}; - -export type { - AssertThatForAny -}; diff --git a/lib/assertions/forAny/assertActualIsEqualToExpected.ts b/lib/assertions/forAny/assertAnyIsEqualToExpected.ts similarity index 91% rename from lib/assertions/forAny/assertActualIsEqualToExpected.ts rename to lib/assertions/forAny/assertAnyIsEqualToExpected.ts index 2d1f45a..2418e4e 100644 --- a/lib/assertions/forAny/assertActualIsEqualToExpected.ts +++ b/lib/assertions/forAny/assertAnyIsEqualToExpected.ts @@ -6,7 +6,7 @@ import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { prettyPrintDiff } from '../../prettyPrint/typeAware/prettyPrintDiff'; import { error, Result, value } from 'defekt'; -const assertActualIsEqualToExpected = function ( +const assertAnyIsEqualToExpected = function ( actual: any, expected: any ): Result { @@ -28,5 +28,5 @@ const assertActualIsEqualToExpected = function ( }; export { - assertActualIsEqualToExpected + assertAnyIsEqualToExpected }; diff --git a/lib/assertions/forAny/assertActualIsFalse.ts b/lib/assertions/forAny/assertAnyIsFalse.ts similarity index 86% rename from lib/assertions/forAny/assertActualIsFalse.ts rename to lib/assertions/forAny/assertAnyIsFalse.ts index 0592283..86abcf2 100644 --- a/lib/assertions/forAny/assertActualIsFalse.ts +++ b/lib/assertions/forAny/assertAnyIsFalse.ts @@ -2,7 +2,7 @@ import { AssertionFailed } from '../../errors'; import { compare } from '../../comparisons/typeAware/compare'; import { error, Result, value } from 'defekt'; -const assertActualIsFalse = function ( +const assertAnyIsFalse = function ( actual: any ): Result { const diff = compare(actual, false); @@ -17,5 +17,5 @@ const assertActualIsFalse = function ( }; export { - assertActualIsFalse + assertAnyIsFalse }; diff --git a/lib/assertions/forAny/assertActualIsFalsy.ts b/lib/assertions/forAny/assertAnyIsFalsy.ts similarity index 88% rename from lib/assertions/forAny/assertActualIsFalsy.ts rename to lib/assertions/forAny/assertAnyIsFalsy.ts index 4760411..8582be5 100644 --- a/lib/assertions/forAny/assertActualIsFalsy.ts +++ b/lib/assertions/forAny/assertAnyIsFalsy.ts @@ -3,7 +3,7 @@ import { dispel } from '../../dispel/dispel'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsFalsy = function ( +const assertAnyIsFalsy = function ( actual: any ): Result { if (!actual) { @@ -17,5 +17,5 @@ const assertActualIsFalsy = function ( }; export { - assertActualIsFalsy + assertAnyIsFalsy }; diff --git a/lib/assertions/forAny/assertActualIsIdenticalToExpected.ts b/lib/assertions/forAny/assertAnyIsIdenticalToExpected.ts similarity index 78% rename from lib/assertions/forAny/assertActualIsIdenticalToExpected.ts rename to lib/assertions/forAny/assertAnyIsIdenticalToExpected.ts index 654117f..c644473 100644 --- a/lib/assertions/forAny/assertActualIsIdenticalToExpected.ts +++ b/lib/assertions/forAny/assertAnyIsIdenticalToExpected.ts @@ -1,7 +1,7 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -const assertActualIsIdenticalToExpected = function ( +const assertAnyIsIdenticalToExpected = function ( actual: any, expected: any ): Result { @@ -15,5 +15,5 @@ const assertActualIsIdenticalToExpected = function ( }; export { - assertActualIsIdenticalToExpected + assertAnyIsIdenticalToExpected }; diff --git a/lib/assertions/forAny/assertActualIsNotEqualToExpected.ts b/lib/assertions/forAny/assertAnyIsNotEqualToExpected.ts similarity index 89% rename from lib/assertions/forAny/assertActualIsNotEqualToExpected.ts rename to lib/assertions/forAny/assertAnyIsNotEqualToExpected.ts index b379033..bc7be5e 100644 --- a/lib/assertions/forAny/assertActualIsNotEqualToExpected.ts +++ b/lib/assertions/forAny/assertAnyIsNotEqualToExpected.ts @@ -5,7 +5,7 @@ import { isEqualDiff } from '../../diffs/EqualDiff'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsNotEqualToExpected = function ( +const assertAnyIsNotEqualToExpected = function ( actual: any, expected: any ): Result { @@ -25,5 +25,5 @@ const assertActualIsNotEqualToExpected = function ( }; export { - assertActualIsNotEqualToExpected + assertAnyIsNotEqualToExpected }; diff --git a/lib/assertions/forAny/assertActualIsNotFalse.ts b/lib/assertions/forAny/assertAnyIsNotFalse.ts similarity index 58% rename from lib/assertions/forAny/assertActualIsNotFalse.ts rename to lib/assertions/forAny/assertAnyIsNotFalse.ts index f976fa0..983f2c9 100644 --- a/lib/assertions/forAny/assertActualIsNotFalse.ts +++ b/lib/assertions/forAny/assertAnyIsNotFalse.ts @@ -1,13 +1,10 @@ import { AssertionFailed } from '../../errors'; -import { compare } from '../../comparisons/typeAware/compare'; import { error, Result, value } from 'defekt'; -const assertActualIsNotFalse = function ( +const assertAnyIsNotFalse = function ( actual: any ): Result { - const diff = compare(actual, true); - - if (diff.cost === 0) { + if (actual !== false) { return value(); } @@ -17,5 +14,5 @@ const assertActualIsNotFalse = function ( }; export { - assertActualIsNotFalse + assertAnyIsNotFalse }; diff --git a/lib/assertions/forAny/assertActualIsNotFalsy.ts b/lib/assertions/forAny/assertAnyIsNotFalsy.ts similarity index 86% rename from lib/assertions/forAny/assertActualIsNotFalsy.ts rename to lib/assertions/forAny/assertAnyIsNotFalsy.ts index b320561..13132e9 100644 --- a/lib/assertions/forAny/assertActualIsNotFalsy.ts +++ b/lib/assertions/forAny/assertAnyIsNotFalsy.ts @@ -3,7 +3,7 @@ import { dispel } from '../../dispel/dispel'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsNotFalsy = function ( +const assertAnyIsNotFalsy = function ( actual: any ): Result { if (actual) { @@ -17,5 +17,5 @@ const assertActualIsNotFalsy = function ( }; export { - assertActualIsNotFalsy + assertAnyIsNotFalsy }; diff --git a/lib/assertions/forAny/assertActualIsNotIdenticalToExpected.ts b/lib/assertions/forAny/assertAnyIsNotIdenticalToExpected.ts similarity index 77% rename from lib/assertions/forAny/assertActualIsNotIdenticalToExpected.ts rename to lib/assertions/forAny/assertAnyIsNotIdenticalToExpected.ts index 4a27254..f6ecdc6 100644 --- a/lib/assertions/forAny/assertActualIsNotIdenticalToExpected.ts +++ b/lib/assertions/forAny/assertAnyIsNotIdenticalToExpected.ts @@ -1,7 +1,7 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -const assertActualIsNotIdenticalToExpected = function ( +const assertAnyIsNotIdenticalToExpected = function ( actual: any, expected: any ): Result { @@ -15,5 +15,5 @@ const assertActualIsNotIdenticalToExpected = function ( }; export { - assertActualIsNotIdenticalToExpected + assertAnyIsNotIdenticalToExpected }; diff --git a/lib/assertions/forAny/assertActualIsNotNull.ts b/lib/assertions/forAny/assertAnyIsNotNull.ts similarity index 81% rename from lib/assertions/forAny/assertActualIsNotNull.ts rename to lib/assertions/forAny/assertAnyIsNotNull.ts index ea320b3..456fb7a 100644 --- a/lib/assertions/forAny/assertActualIsNotNull.ts +++ b/lib/assertions/forAny/assertAnyIsNotNull.ts @@ -1,7 +1,7 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -const assertActualIsNotNull = function ( +const assertAnyIsNotNull = function ( actual: any ): Result { if (actual !== null) { @@ -14,5 +14,5 @@ const assertActualIsNotNull = function ( }; export { - assertActualIsNotNull + assertAnyIsNotNull }; diff --git a/lib/assertions/forAny/assertActualIsNotOfType.ts b/lib/assertions/forAny/assertAnyIsNotOfType.ts similarity index 98% rename from lib/assertions/forAny/assertActualIsNotOfType.ts rename to lib/assertions/forAny/assertAnyIsNotOfType.ts index 4e65b1d..340b0ef 100644 --- a/lib/assertions/forAny/assertActualIsNotOfType.ts +++ b/lib/assertions/forAny/assertAnyIsNotOfType.ts @@ -4,7 +4,7 @@ import { AssertionFailed, InvalidOperation } from '../../errors'; import { error, isResult, Result, value } from 'defekt'; import { isArray, isBoolean, isError, isFunction, isMap, isNull, isNumber, isObject, isSet, isString, isSymbol, isUndefined, Type } from 'typedescriptor'; -const assertActualIsNotOfType = function ( +const assertAnyIsNotOfType = function ( actual: any, expected: Type | 'result' ): Result { @@ -137,5 +137,5 @@ const assertActualIsNotOfType = function ( }; export { - assertActualIsNotOfType + assertAnyIsNotOfType }; diff --git a/lib/assertions/forAny/assertActualIsNotSameJsonAsExpected.ts b/lib/assertions/forAny/assertAnyIsNotSameJsonAsExpected.ts similarity index 84% rename from lib/assertions/forAny/assertActualIsNotSameJsonAsExpected.ts rename to lib/assertions/forAny/assertAnyIsNotSameJsonAsExpected.ts index 08306da..4656a7b 100644 --- a/lib/assertions/forAny/assertActualIsNotSameJsonAsExpected.ts +++ b/lib/assertions/forAny/assertAnyIsNotSameJsonAsExpected.ts @@ -1,7 +1,7 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -const assertActualIsNotSameJsonAsExpected = function ( +const assertAnyIsNotSameJsonAsExpected = function ( actual: any, expected: any ): Result { @@ -19,5 +19,5 @@ const assertActualIsNotSameJsonAsExpected = function ( }; export { - assertActualIsNotSameJsonAsExpected + assertAnyIsNotSameJsonAsExpected }; diff --git a/lib/assertions/forAny/assertActualIsNotTrue.ts b/lib/assertions/forAny/assertAnyIsNotTrue.ts similarity index 58% rename from lib/assertions/forAny/assertActualIsNotTrue.ts rename to lib/assertions/forAny/assertAnyIsNotTrue.ts index 213e89e..2ceb419 100644 --- a/lib/assertions/forAny/assertActualIsNotTrue.ts +++ b/lib/assertions/forAny/assertAnyIsNotTrue.ts @@ -1,13 +1,10 @@ import { AssertionFailed } from '../../errors'; -import { compare } from '../../comparisons/typeAware/compare'; import { error, Result, value } from 'defekt'; -const assertActualIsNotTrue = function ( +const assertAnyIsNotTrue = function ( actual: any ): Result { - const diff = compare(actual, false); - - if (diff.cost === 0) { + if (actual !== true) { return value(); } @@ -17,5 +14,5 @@ const assertActualIsNotTrue = function ( }; export { - assertActualIsNotTrue + assertAnyIsNotTrue }; diff --git a/lib/assertions/forAny/assertActualIsNotTruthy.ts b/lib/assertions/forAny/assertAnyIsNotTruthy.ts similarity index 86% rename from lib/assertions/forAny/assertActualIsNotTruthy.ts rename to lib/assertions/forAny/assertAnyIsNotTruthy.ts index 3d1d365..7a381c5 100644 --- a/lib/assertions/forAny/assertActualIsNotTruthy.ts +++ b/lib/assertions/forAny/assertAnyIsNotTruthy.ts @@ -3,7 +3,7 @@ import { dispel } from '../../dispel/dispel'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsNotTruthy = function ( +const assertAnyIsNotTruthy = function ( actual: any ): Result { if (!actual) { @@ -17,5 +17,5 @@ const assertActualIsNotTruthy = function ( }; export { - assertActualIsNotTruthy + assertAnyIsNotTruthy }; diff --git a/lib/assertions/forAny/assertActualIsNotUndefined.ts b/lib/assertions/forAny/assertAnyIsNotUndefined.ts similarity index 80% rename from lib/assertions/forAny/assertActualIsNotUndefined.ts rename to lib/assertions/forAny/assertAnyIsNotUndefined.ts index d216d1b..ef101de 100644 --- a/lib/assertions/forAny/assertActualIsNotUndefined.ts +++ b/lib/assertions/forAny/assertAnyIsNotUndefined.ts @@ -1,7 +1,7 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -const assertActualIsNotUndefined = function ( +const assertAnyIsNotUndefined = function ( actual: any ): Result { if (actual !== undefined) { @@ -14,5 +14,5 @@ const assertActualIsNotUndefined = function ( }; export { - assertActualIsNotUndefined + assertAnyIsNotUndefined }; diff --git a/lib/assertions/forAny/assertActualIsNull.ts b/lib/assertions/forAny/assertAnyIsNull.ts similarity index 88% rename from lib/assertions/forAny/assertActualIsNull.ts rename to lib/assertions/forAny/assertAnyIsNull.ts index d483954..0bfb3c2 100644 --- a/lib/assertions/forAny/assertActualIsNull.ts +++ b/lib/assertions/forAny/assertAnyIsNull.ts @@ -3,7 +3,7 @@ import { dispel } from '../../dispel/dispel'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsNull = function ( +const assertAnyIsNull = function ( actual: any ): Result { if (actual === null) { @@ -17,5 +17,5 @@ const assertActualIsNull = function ( }; export { - assertActualIsNull + assertAnyIsNull }; diff --git a/lib/assertions/forAny/assertActualIsOfType.ts b/lib/assertions/forAny/assertAnyIsOfType.ts similarity index 98% rename from lib/assertions/forAny/assertActualIsOfType.ts rename to lib/assertions/forAny/assertAnyIsOfType.ts index afd16f3..a798440 100644 --- a/lib/assertions/forAny/assertActualIsOfType.ts +++ b/lib/assertions/forAny/assertAnyIsOfType.ts @@ -4,7 +4,7 @@ import { AssertionFailed, InvalidOperation } from '../../errors'; import { error, isResult, Result, value } from 'defekt'; import { isArray, isBoolean, isError, isFunction, isMap, isNull, isNumber, isObject, isSet, isString, isSymbol, isUndefined, Type } from 'typedescriptor'; -const assertActualIsOfType = function ( +const assertAnyIsOfType = function ( actual: any, expected: Type | 'result' ): Result { @@ -137,5 +137,5 @@ const assertActualIsOfType = function ( }; export { - assertActualIsOfType + assertAnyIsOfType }; diff --git a/lib/assertions/forAny/assertActualIsSameJsonAsExpected.ts b/lib/assertions/forAny/assertAnyIsSameJsonAsExpected.ts similarity index 89% rename from lib/assertions/forAny/assertActualIsSameJsonAsExpected.ts rename to lib/assertions/forAny/assertAnyIsSameJsonAsExpected.ts index b968cbd..2ee814f 100644 --- a/lib/assertions/forAny/assertActualIsSameJsonAsExpected.ts +++ b/lib/assertions/forAny/assertAnyIsSameJsonAsExpected.ts @@ -3,7 +3,7 @@ import { compare } from '../../comparisons/typeAware/compare'; import { prettyPrintDiff } from '../../prettyPrint/typeAware/prettyPrintDiff'; import { error, Result, value } from 'defekt'; -const assertActualIsSameJsonAsExpected = function ( +const assertAnyIsSameJsonAsExpected = function ( actual: any, expected: any ): Result { @@ -25,5 +25,5 @@ const assertActualIsSameJsonAsExpected = function ( }; export { - assertActualIsSameJsonAsExpected + assertAnyIsSameJsonAsExpected }; diff --git a/lib/assertions/forAny/assertActualIsTrue.ts b/lib/assertions/forAny/assertAnyIsTrue.ts similarity index 87% rename from lib/assertions/forAny/assertActualIsTrue.ts rename to lib/assertions/forAny/assertAnyIsTrue.ts index 1d14326..b64e74b 100644 --- a/lib/assertions/forAny/assertActualIsTrue.ts +++ b/lib/assertions/forAny/assertAnyIsTrue.ts @@ -2,7 +2,7 @@ import { AssertionFailed } from '../../errors'; import { compare } from '../../comparisons/typeAware/compare'; import { error, Result, value } from 'defekt'; -const assertActualIsTrue = function ( +const assertAnyIsTrue = function ( actual: any ): Result { const diff = compare(actual, true); @@ -17,5 +17,5 @@ const assertActualIsTrue = function ( }; export { - assertActualIsTrue + assertAnyIsTrue }; diff --git a/lib/assertions/forAny/assertActualIsTruthy.ts b/lib/assertions/forAny/assertAnyIsTruthy.ts similarity index 87% rename from lib/assertions/forAny/assertActualIsTruthy.ts rename to lib/assertions/forAny/assertAnyIsTruthy.ts index 8f1146d..c63be4e 100644 --- a/lib/assertions/forAny/assertActualIsTruthy.ts +++ b/lib/assertions/forAny/assertAnyIsTruthy.ts @@ -3,7 +3,7 @@ import { dispel } from '../../dispel/dispel'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsTruthy = function ( +const assertAnyIsTruthy = function ( actual: any ): Result { if (actual) { @@ -17,5 +17,5 @@ const assertActualIsTruthy = function ( }; export { - assertActualIsTruthy + assertAnyIsTruthy }; diff --git a/lib/assertions/forAny/assertActualIsUndefined.ts b/lib/assertions/forAny/assertAnyIsUndefined.ts similarity index 87% rename from lib/assertions/forAny/assertActualIsUndefined.ts rename to lib/assertions/forAny/assertAnyIsUndefined.ts index 06aa8a7..c347608 100644 --- a/lib/assertions/forAny/assertActualIsUndefined.ts +++ b/lib/assertions/forAny/assertAnyIsUndefined.ts @@ -3,7 +3,7 @@ import { dispel } from '../../dispel/dispel'; import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint'; import { error, Result, value } from 'defekt'; -const assertActualIsUndefined = function ( +const assertAnyIsUndefined = function ( actual: any ): Result { if (actual === undefined) { @@ -17,5 +17,5 @@ const assertActualIsUndefined = function ( }; export { - assertActualIsUndefined + assertAnyIsUndefined }; diff --git a/lib/assertions/forAny/assertions.ts b/lib/assertions/forAny/assertions.ts deleted file mode 100644 index 0d9f1f5..0000000 --- a/lib/assertions/forAny/assertions.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { assertActualIsEqualToExpected } from './assertActualIsEqualToExpected'; -import { assertActualIsFalse } from './assertActualIsFalse'; -import { assertActualIsFalsy } from './assertActualIsFalsy'; -import { assertActualIsIdenticalToExpected } from './assertActualIsIdenticalToExpected'; -import { assertActualIsNotEqualToExpected } from './assertActualIsNotEqualToExpected'; -import { assertActualIsNotFalse } from './assertActualIsNotFalse'; -import { assertActualIsNotFalsy } from './assertActualIsNotFalsy'; -import { assertActualIsNotIdenticalToExpected } from './assertActualIsNotIdenticalToExpected'; -import { assertActualIsNotNull } from './assertActualIsNotNull'; -import { assertActualIsNotOfType } from './assertActualIsNotOfType'; -import { assertActualIsNotSameJsonAsExpected } from './assertActualIsNotSameJsonAsExpected'; -import { assertActualIsNotTrue } from './assertActualIsNotTrue'; -import { assertActualIsNotTruthy } from './assertActualIsNotTruthy'; -import { assertActualIsNotUndefined } from './assertActualIsNotUndefined'; -import { assertActualIsNull } from './assertActualIsNull'; -import { assertActualIsOfType } from './assertActualIsOfType'; -import { assertActualIsSameJsonAsExpected } from './assertActualIsSameJsonAsExpected'; -import { assertActualIsTrue } from './assertActualIsTrue'; -import { assertActualIsTruthy } from './assertActualIsTruthy'; -import { assertActualIsUndefined } from './assertActualIsUndefined'; -import { CommonAssertions } from './CommonAssertions'; -import { report } from '../../report'; - -const getAssertionsForAny = function (actual: TAny): CommonAssertions { - return { - equalTo (expected: TAny): void { - report(assertActualIsEqualToExpected(actual, expected)); - }, - identicalTo (expected: TAny): void { - report(assertActualIsIdenticalToExpected(actual, expected)); - }, - sameJsonAs (expected: TAny): void { - report(assertActualIsSameJsonAsExpected(actual, expected)); - }, - - falsy (): void { - report(assertActualIsFalsy(actual)); - }, - truthy (): void { - report(assertActualIsTruthy(actual)); - }, - - null (): void { - report(assertActualIsNull(actual)); - }, - undefined (): void { - report(assertActualIsUndefined(actual)); - }, - false (): void { - report(assertActualIsFalse(actual)); - }, - true (): void { - report(assertActualIsTrue(actual)); - }, - - ofType (expected): void { - report(assertActualIsOfType(actual, expected)); - } - }; -}; - -const getNegatedAssertionsForAny = function (actual: TAny): CommonAssertions { - return { - equalTo (expected: TAny): void { - report(assertActualIsNotEqualToExpected(actual, expected)); - }, - identicalTo (expected: TAny): void { - report(assertActualIsNotIdenticalToExpected(actual, expected)); - }, - sameJsonAs (expected: TAny): void { - report(assertActualIsNotSameJsonAsExpected(actual, expected)); - }, - - falsy (): void { - report(assertActualIsNotFalsy(actual)); - }, - truthy (): void { - report(assertActualIsNotTruthy(actual)); - }, - - null (): void { - report(assertActualIsNotNull(actual)); - }, - undefined (): void { - report(assertActualIsNotUndefined(actual)); - }, - false (): void { - report(assertActualIsNotFalse(actual)); - }, - true (): void { - report(assertActualIsNotTrue(actual)); - }, - - ofType (expected): void { - report(assertActualIsNotOfType(actual, expected)); - } - }; -}; - -export { - getAssertionsForAny, - getNegatedAssertionsForAny -}; diff --git a/lib/assertions/forArrays/AssertThatForArray.ts b/lib/assertions/forArrays/AssertThatForArray.ts deleted file mode 100644 index a9aa822..0000000 --- a/lib/assertions/forArrays/AssertThatForArray.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ArrayAssertions } from './ArrayAssertions'; -import { CommonAssertions } from '../forAny/CommonAssertions'; - -type AssertThatForArray = (actual: TContent[]) => { - is: CommonAssertions & ArrayAssertions & { - not: CommonAssertions & ArrayAssertions; - }; -}; - -export type { - AssertThatForArray -}; diff --git a/lib/assertions/forArrays/assertions.ts b/lib/assertions/forArrays/assertions.ts deleted file mode 100644 index de276da..0000000 --- a/lib/assertions/forArrays/assertions.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ArrayAssertions } from './ArrayAssertions'; -import { assertArrayIsContainingAllOfIterable } from './assertArrayIsContainingAllOfIterable'; -import { assertArrayIsContainingAnyOfIterable } from './assertArrayIsContainingAnyOfIterable'; -import { assertArrayIsContainingItem } from './assertArrayIsContainingItem'; -import { assertArrayIsEmpty } from './assertArrayIsEmpty'; -import { assertArrayIsNotContainingAllOfIterable } from './assertArrayIsNotContainingAllOfIterable'; -import { assertArrayIsNotContainingAnyOfIterable } from './assertArrayIsNotContainingAnyOfIterable'; -import { assertArrayIsNotContainingItem } from './assertArrayIsNotContainingItem'; -import { assertArrayIsNotEmpty } from './assertArrayIsNotEmpty'; -import { report } from '../../report'; - -const getAssertionsForArray = function (actual: TContent[]): ArrayAssertions { - return { - containing (item: TContent): void { - report(assertArrayIsContainingItem(actual, item)); - }, - containingAllOf (iterable: Iterable): void { - report(assertArrayIsContainingAllOfIterable(actual, iterable)); - }, - containingAnyOf (iterable: Iterable): void { - report(assertArrayIsContainingAnyOfIterable(actual, iterable)); - }, - empty (): void { - report(assertArrayIsEmpty(actual)); - } - }; -}; - -const getNegatedAssertionsForArray = function (actual: TContent[]): ArrayAssertions { - return { - containing (item: TContent): void { - report(assertArrayIsNotContainingItem(actual, item)); - }, - containingAllOf (iterable: Iterable): void { - report(assertArrayIsNotContainingAllOfIterable(actual, iterable)); - }, - containingAnyOf (iterable: Iterable): void { - report(assertArrayIsNotContainingAnyOfIterable(actual, iterable)); - }, - empty (): void { - report(assertArrayIsNotEmpty(actual)); - } - }; -}; - -export { - getAssertionsForArray, - getNegatedAssertionsForArray -}; diff --git a/lib/assertions/forFunctions/AssertThatForFunction.ts b/lib/assertions/forFunctions/AssertThatForFunction.ts deleted file mode 100644 index 1a23bd9..0000000 --- a/lib/assertions/forFunctions/AssertThatForFunction.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { FunctionAssertions } from './FunctionAssertions'; - -/* eslint-disable @typescript-eslint/ban-types */ -type AssertThatForFunction = (actual: Function) => { - is: CommonAssertions & FunctionAssertions & { - not: CommonAssertions & FunctionAssertions; - }; -}; -/* eslint-enable @typescript-eslint/ban-types */ - -export type { - AssertThatForFunction -}; diff --git a/lib/assertions/forFunctions/assertFunctionIsNotThrowing.ts b/lib/assertions/forFunctions/assertFunctionIsNotThrowing.ts index b9acb99..ea1f5f9 100644 --- a/lib/assertions/forFunctions/assertFunctionIsNotThrowing.ts +++ b/lib/assertions/forFunctions/assertFunctionIsNotThrowing.ts @@ -1,9 +1,8 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -/* eslint-disable @typescript-eslint/ban-types */ const assertFunctionIsNotThrowing = function ( - actual: Function, + actual: (...args: any[]) => any, expected?: string | RegExp | ((ex: TError) => boolean) ): Result { try { @@ -43,7 +42,6 @@ const assertFunctionIsNotThrowing = function ( return value(); }; -/* eslint-enable @typescript-eslint/ban-types */ export { assertFunctionIsNotThrowing diff --git a/lib/assertions/forFunctions/assertFunctionIsNotThrowingAsync.ts b/lib/assertions/forFunctions/assertFunctionIsNotThrowingAsync.ts index 0fccf2a..2413491 100644 --- a/lib/assertions/forFunctions/assertFunctionIsNotThrowingAsync.ts +++ b/lib/assertions/forFunctions/assertFunctionIsNotThrowingAsync.ts @@ -1,9 +1,8 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -/* eslint-disable @typescript-eslint/ban-types */ const assertFunctionIsNotThrowingAsync = async function ( - actual: Function, + actual: (...args: any[]) => any, expected?: string | RegExp | ((ex: TError) => boolean) ): Promise> { try { @@ -51,7 +50,6 @@ const assertFunctionIsNotThrowingAsync = async function ( - actual: Function, + actual: (...args: any[]) => any, expected?: string | RegExp | ((ex: TError) => boolean) ): Result { try { @@ -52,7 +51,6 @@ const assertFunctionIsThrowing = function ( message: 'The function did not throw an exception.' })); }; -/* eslint-enable @typescript-eslint/ban-types */ export { assertFunctionIsThrowing diff --git a/lib/assertions/forFunctions/assertFunctionIsThrowingAsync.ts b/lib/assertions/forFunctions/assertFunctionIsThrowingAsync.ts index e146562..e189a53 100644 --- a/lib/assertions/forFunctions/assertFunctionIsThrowingAsync.ts +++ b/lib/assertions/forFunctions/assertFunctionIsThrowingAsync.ts @@ -1,9 +1,8 @@ import { AssertionFailed } from '../../errors'; import { error, Result, value } from 'defekt'; -/* eslint-disable @typescript-eslint/ban-types */ const assertFunctionIsThrowingAsync = async function ( - actual: Function, + actual: (...args: any[]) => any, expected?: string | RegExp | ((ex: TError) => boolean) ): Promise> { try { @@ -60,7 +59,6 @@ const assertFunctionIsThrowingAsync = async function ( - expected?: string | RegExp | ((ex: TError) => boolean) - ): void { - report(assertFunctionIsThrowing(actual, expected)); - }, - async throwingAsync ( - expected?: string | RegExp | ((ex: TError) => boolean) - ): Promise { - report(await assertFunctionIsThrowingAsync(actual, expected)); - } - }; -}; - -const getNegatedAssertionsForFunction = function ( -// eslint-disable-next-line @typescript-eslint/ban-types - actual: Function -): FunctionAssertions { - return { - throwing ( - expected?: string | RegExp | ((ex: TError) => boolean) - ): void { - report(assertFunctionIsNotThrowing(actual, expected)); - }, - async throwingAsync ( - expected?: string | RegExp | ((ex: TError) => boolean) - ): Promise { - report(await assertFunctionIsNotThrowingAsync(actual, expected)); - } - }; -}; - -export { - getAssertionsForFunction, - getNegatedAssertionsForFunction -}; diff --git a/lib/assertions/forMaps/AssertThatForMap.ts b/lib/assertions/forMaps/AssertThatForMap.ts deleted file mode 100644 index c0c46b0..0000000 --- a/lib/assertions/forMaps/AssertThatForMap.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { MapAssertions } from './MapAssertions'; - -type AssertThatForMap = (actual: Map) => { - is: CommonAssertions> & MapAssertions & { - not: CommonAssertions> & MapAssertions; - }; -}; - -export type { - AssertThatForMap -}; diff --git a/lib/assertions/forMaps/assertions.ts b/lib/assertions/forMaps/assertions.ts deleted file mode 100644 index d5688be..0000000 --- a/lib/assertions/forMaps/assertions.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { assertMapIsAtLeastMap } from './assertMapIsAtLeastMap'; -import { assertMapIsAtMostMap } from './assertMapIsAtMostMap'; -import { assertMapIsEmpty } from './assertMapIsEmpty'; -import { assertMapIsNotAtLeastMap } from './assertMapIsNotAtLeastMap'; -import { assertMapIsNotAtMostMap } from './assertMapIsNotAtMostMap'; -import { assertMapIsNotEmpty } from './assertMapIsNotEmpty'; -import { MapAssertions } from './MapAssertions'; -import { report } from '../../report'; - -const getAssertionsForMap = function ( - actual: Map -): MapAssertions { - return { - atLeast (expected): void { - report(assertMapIsAtLeastMap(actual, expected)); - }, - atMost (expected): void { - report(assertMapIsAtMostMap(actual, expected)); - }, - empty (): void { - report(assertMapIsEmpty(actual)); - } - }; -}; - -const getNegatedAssertionsForMap = function ( - actual: Map -): MapAssertions { - return { - atLeast (expected): void { - report(assertMapIsNotAtLeastMap(actual, expected)); - }, - atMost (expected): void { - report(assertMapIsNotAtMostMap(actual, expected)); - }, - empty (): void { - report(assertMapIsNotEmpty(actual)); - } - }; -}; - -export { - getAssertionsForMap, - getNegatedAssertionsForMap -}; diff --git a/lib/assertions/forNumbers/AssertThatForNumber.ts b/lib/assertions/forNumbers/AssertThatForNumber.ts deleted file mode 100644 index ad8611b..0000000 --- a/lib/assertions/forNumbers/AssertThatForNumber.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { NumberAssertions } from './NumberAssertions'; - -type AssertThatForNumber = (actual: number) => { - is: CommonAssertions & NumberAssertions & { - not: CommonAssertions & NumberAssertions; - }; -}; - -export type { - AssertThatForNumber -}; diff --git a/lib/assertions/forNumbers/assertions.ts b/lib/assertions/forNumbers/assertions.ts deleted file mode 100644 index 8cde4f7..0000000 --- a/lib/assertions/forNumbers/assertions.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { assertNumberIsAtLeastNumber } from './assertNumberIsAtLeastNumber'; -import { assertNumberIsAtMostNumber } from './assertNumberIsAtMostNumber'; -import { assertNumberIsGreaterThanNumber } from './assertNumberIsGreaterThanNumber'; -import { assertNumberIsLessThanNumber } from './assertNumberIsLessThanNumber'; -import { assertNumberIsNaN } from './assertNumberIsNaN'; -import { assertNumberIsNotAtLeastNumber } from './assertNumberIsNotAtLeastNumber'; -import { assertNumberIsNotAtMostNumber } from './assertNumberIsNotAtMostNumber'; -import { assertNumberIsNotGreaterThanNumber } from './assertNumberIsNotGreaterThanNumber'; -import { assertNumberIsNotLessThanNumber } from './assertNumberIsNotLessThanNumber'; -import { assertNumberIsNotNaN } from './assertNumberIsNotNaN'; -import { NumberAssertions } from './NumberAssertions'; -import { report } from '../../report'; - -const getAssertionsForNumber = function (actual: number): NumberAssertions { - return { - greaterThan (expected): void { - report(assertNumberIsGreaterThanNumber(actual, expected)); - }, - lessThan (expected): void { - report(assertNumberIsLessThanNumber(actual, expected)); - }, - atLeast (expected): void { - report(assertNumberIsAtLeastNumber(actual, expected)); - }, - atMost (expected): void { - report(assertNumberIsAtMostNumber(actual, expected)); - }, - NaN (): void { - report(assertNumberIsNaN(actual)); - } - }; -}; - -const getNegatedAssertionsForNumber = function (actual: number): NumberAssertions { - return { - greaterThan (expected): void { - report(assertNumberIsNotGreaterThanNumber(actual, expected)); - }, - lessThan (expected): void { - report(assertNumberIsNotLessThanNumber(actual, expected)); - }, - atLeast (expected): void { - report(assertNumberIsNotAtLeastNumber(actual, expected)); - }, - atMost (expected): void { - report(assertNumberIsNotAtMostNumber(actual, expected)); - }, - NaN (): void { - report(assertNumberIsNotNaN(actual)); - } - }; -}; - -export { - getAssertionsForNumber, - getNegatedAssertionsForNumber -}; diff --git a/lib/assertions/forObjects/AssertThatForObject.ts b/lib/assertions/forObjects/AssertThatForObject.ts deleted file mode 100644 index 4b12450..0000000 --- a/lib/assertions/forObjects/AssertThatForObject.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { ObjectAssertions } from './ObjectAssertions'; - -type AssertThatForObject = (actual: object) => { - is: CommonAssertions & ObjectAssertions & { - not: CommonAssertions & ObjectAssertions; - }; -}; - -export type { - AssertThatForObject -}; diff --git a/lib/assertions/forObjects/assertions.ts b/lib/assertions/forObjects/assertions.ts deleted file mode 100644 index 505a475..0000000 --- a/lib/assertions/forObjects/assertions.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { assertObjectIsAtLeastObject } from './assertObjectIsAtLeastObject'; -import { assertObjectIsAtMostObject } from './assertObjectIsAtMostObject'; -import { assertObjectIsEmpty } from './assertObjectIsEmpty'; -import { assertObjectIsInstanceOfClass } from './assertObjectIsInstanceOfClass'; -import { assertObjectIsNotAtLeastObject } from './assertObjectIsNotAtLeastObject'; -import { assertObjectIsNotAtMostObject } from './assertObjectIsNotAtMostObject'; -import { assertObjectIsNotEmpty } from './assertObjectIsNotEmpty'; -import { assertObjectIsNotInstanceOfClass } from './assertObjectIsNotInstanceOfClass'; -import { ObjectAssertions } from './ObjectAssertions'; -import { report } from '../../report'; - -const getAssertionsForObject = function (actual: object): ObjectAssertions { - return { - atLeast (expected): void { - report(assertObjectIsAtLeastObject(actual, expected)); - }, - atMost (expected): void { - report(assertObjectIsAtMostObject(actual, expected)); - }, - instanceOf (expected): void { - report(assertObjectIsInstanceOfClass(actual, expected)); - }, - empty (): void { - report(assertObjectIsEmpty(actual)); - } - }; -}; - -const getNegatedAssertionsForObject = function (actual: object): ObjectAssertions { - return { - atLeast (expected): void { - report(assertObjectIsNotAtLeastObject(actual, expected)); - }, - atMost (expected): void { - report(assertObjectIsNotAtMostObject(actual, expected)); - }, - instanceOf (expected): void { - report(assertObjectIsNotInstanceOfClass(actual, expected)); - }, - empty (): void { - report(assertObjectIsNotEmpty(actual)); - } - }; -}; - -export { - getAssertionsForObject, - getNegatedAssertionsForObject -}; diff --git a/lib/assertions/forResults/AssertThatForResult.ts b/lib/assertions/forResults/AssertThatForResult.ts deleted file mode 100644 index 88e954f..0000000 --- a/lib/assertions/forResults/AssertThatForResult.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { Result } from 'defekt'; -import { ResultAssertions } from './ResultAssertions'; - -type AssertThatForResult = (actual: Result) => { - is: CommonAssertions> & ResultAssertions & { - not: CommonAssertions> & ResultAssertions; - }; -}; - -export type { - AssertThatForResult -}; diff --git a/lib/assertions/forResults/assertions.ts b/lib/assertions/forResults/assertions.ts deleted file mode 100644 index 7e304de..0000000 --- a/lib/assertions/forResults/assertions.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { assertResultIsAnError } from './assertResultIsAnError'; -import { assertResultIsAnErrorWithMessage } from './assertResultIsAnErrorWithMessage'; -import { assertResultIsAValue } from './assertResultIsAValue'; -import { assertResultIsNotAnError } from './assertResultIsNotAnError'; -import { assertResultIsNotAnErrorWithMessage } from './assertResultIsNotAnErrorWithMessage'; -import { assertResultIsNotAValue } from './assertResultIsNotAValue'; -import { report } from '../../report'; -import { Result } from 'defekt'; -import { ResultAssertions } from './ResultAssertions'; - -const getAssertionsForResult = function ( - actual: Result -): ResultAssertions { - return { - aValue (): void { - report(assertResultIsAValue(actual)); - }, - anError (): void { - report(assertResultIsAnError(actual)); - }, - anErrorWithMessage (expected): void { - report(assertResultIsAnErrorWithMessage(actual, expected)); - } - }; -}; - -const getNegatedAssertionsForResult = function ( - actual: Result -): ResultAssertions { - return { - aValue (): void { - report(assertResultIsNotAValue(actual)); - }, - anError (): void { - report(assertResultIsNotAnError(actual)); - }, - anErrorWithMessage (expected): void { - report(assertResultIsNotAnErrorWithMessage(actual, expected)); - } - }; -}; - -export { - getAssertionsForResult, - getNegatedAssertionsForResult -}; diff --git a/lib/assertions/forSets/AssertThatForSet.ts b/lib/assertions/forSets/AssertThatForSet.ts deleted file mode 100644 index 047f9c7..0000000 --- a/lib/assertions/forSets/AssertThatForSet.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { SetAssertions } from './SetAssertions'; - -type AssertThatForSet = (actual: Set) => { - is: CommonAssertions> & SetAssertions & { - not: CommonAssertions> & SetAssertions; - }; -}; - -export type { - AssertThatForSet -}; diff --git a/lib/assertions/forSets/assertions.ts b/lib/assertions/forSets/assertions.ts deleted file mode 100644 index 44ae29e..0000000 --- a/lib/assertions/forSets/assertions.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { assertSetIsAtLeastSet } from './assertSetIsAtLeastSet'; -import { assertSetIsAtMostSet } from './assertSetIsAtMostSet'; -import { assertSetIsContainingAllOfIterable } from './assertSetIsContainingAllOfIterable'; -import { assertSetIsContainingAnyOfIterable } from './assertSetIsContainingAnyOfIterable'; -import { assertSetIsContainingItem } from './assertSetIsContainingItem'; -import { assertSetIsEmpty } from './assertSetIsEmpty'; -import { assertSetIsNotAtLeastSet } from './assertSetIsNotAtLeastSet'; -import { assertSetIsNotAtMostSet } from './assertSetIsNotAtMostSet'; -import { assertSetIsNotContainingAllOfIterable } from './assertSetIsNotContainingAllOfIterable'; -import { assertSetIsNotContainingAnyOfIterable } from './assertSetIsNotContainingAnyOfIterable'; -import { assertSetIsNotContainingItem } from './assertSetIsNotContainingItem'; -import { assertSetIsNotEmpty } from './assertSetIsNotEmpty'; -import { report } from '../../report'; -import { SetAssertions } from './SetAssertions'; - -const getAssertionsForSet = function (actual: Set): SetAssertions { - return { - containing (item): void { - report(assertSetIsContainingItem(actual, item)); - }, - containingAllOf (iterable): void { - report(assertSetIsContainingAllOfIterable(actual, iterable)); - }, - containingAnyOf (iterable): void { - report(assertSetIsContainingAnyOfIterable(actual, iterable)); - }, - atLeast (expected): void { - report(assertSetIsAtLeastSet(actual, expected)); - }, - atMost (expected): void { - report(assertSetIsAtMostSet(actual, expected)); - }, - empty (): void { - report(assertSetIsEmpty(actual)); - } - }; -}; - -const getNegatedAssertionsForSet = function (actual: Set): SetAssertions { - return { - containing (item): void { - report(assertSetIsNotContainingItem(actual, item)); - }, - containingAllOf (iterable): void { - report(assertSetIsNotContainingAllOfIterable(actual, iterable)); - }, - containingAnyOf (iterable): void { - report(assertSetIsNotContainingAnyOfIterable(actual, iterable)); - }, - atLeast (expected): void { - report(assertSetIsNotAtLeastSet(actual, expected)); - }, - atMost (expected): void { - report(assertSetIsNotAtMostSet(actual, expected)); - }, - empty (): void { - report(assertSetIsNotEmpty(actual)); - } - }; -}; - -export { - getAssertionsForSet, - getNegatedAssertionsForSet -}; diff --git a/lib/assertions/forStrings/AssertThatForString.ts b/lib/assertions/forStrings/AssertThatForString.ts deleted file mode 100644 index 373be10..0000000 --- a/lib/assertions/forStrings/AssertThatForString.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CommonAssertions } from '../forAny/CommonAssertions'; -import { StringAssertions } from './StringAssertions'; - -type AssertThatForString = (actual: string) => { - is: CommonAssertions & StringAssertions & { - not: CommonAssertions & StringAssertions; - }; -}; - -export type { - AssertThatForString -}; diff --git a/lib/assertions/forStrings/assertions.ts b/lib/assertions/forStrings/assertions.ts deleted file mode 100644 index a4ebeb0..0000000 --- a/lib/assertions/forStrings/assertions.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { assertStringIsContainingAllOfIterable } from './assertStringIsContainingAllOfIterable'; -import { assertStringIsContainingAnyOfIterable } from './assertStringIsContainingAnyOfIterable'; -import { assertStringIsContainingString } from './assertStringIsContainingString'; -import { assertStringIsEmpty } from './assertStringIsEmpty'; -import { assertStringIsEndingWithString } from './assertStringIsEndingWithString'; -import { assertStringIsMatchingRegExp } from './assertStringIsMatchingRegExp'; -import { assertStringIsNotContainingAllOfIterable } from './assertStringIsNotContainingAllOfIterable'; -import { assertStringIsNotContainingAnyOfIterable } from './assertStringIsNotContainingAnyOfIterable'; -import { assertStringIsNotContainingString } from './assertStringIsNotContainingString'; -import { assertStringIsNotEmpty } from './assertStringIsNotEmpty'; -import { assertStringIsNotEndingWithString } from './assertStringIsNotEndingWithString'; -import { assertStringIsNotMatchingRegExp } from './assertStringIsNotMatchingRegExp'; -import { assertStringIsNotStartingWithString } from './assertStringIsNotStartingWithString'; -import { assertStringIsStartingWithString } from './assertStringIsStartingWithString'; -import { report } from '../../report'; -import { StringAssertions } from './StringAssertions'; - -const getAssertionsForString = function (actual: string): StringAssertions { - return { - containing (expected): void { - report(assertStringIsContainingString(actual, expected)); - }, - startingWith (expected): void { - report(assertStringIsStartingWithString(actual, expected)); - }, - endingWith (expected): void { - report(assertStringIsEndingWithString(actual, expected)); - }, - containingAllOf (expected): void { - report(assertStringIsContainingAllOfIterable(actual, expected)); - }, - containingAnyOf (expected): void { - report(assertStringIsContainingAnyOfIterable(actual, expected)); - }, - empty (): void { - report(assertStringIsEmpty(actual)); - }, - matching (expected: RegExp): void { - report(assertStringIsMatchingRegExp(actual, expected)); - } - }; -}; - -const getNegatedAssertionsForString = function (actual: string): StringAssertions { - return { - containing (expected): void { - report(assertStringIsNotContainingString(actual, expected)); - }, - startingWith (expected): void { - report(assertStringIsNotStartingWithString(actual, expected)); - }, - endingWith (expected): void { - report(assertStringIsNotEndingWithString(actual, expected)); - }, - containingAllOf (expected): void { - report(assertStringIsNotContainingAllOfIterable(actual, expected)); - }, - containingAnyOf (expected): void { - report(assertStringIsNotContainingAnyOfIterable(actual, expected)); - }, - empty (): void { - report(assertStringIsNotEmpty(actual)); - }, - matching (expected: RegExp): void { - report(assertStringIsNotMatchingRegExp(actual, expected)); - } - }; -}; - -export { - getAssertionsForString, - getNegatedAssertionsForString -}; diff --git a/lib/assertthat.ts b/lib/assertthat.ts index 9f6ca96..f353c25 100644 --- a/lib/assertthat.ts +++ b/lib/assertthat.ts @@ -1,60 +1,48 @@ -import { AssertThatForAny } from './assertions/forAny/AssertThatForAny'; -import { AssertThatForArray } from './assertions/forArrays/AssertThatForArray'; -import { AssertThatForFunction } from './assertions/forFunctions/AssertThatForFunction'; -import { AssertThatForMap } from './assertions/forMaps/AssertThatForMap'; -import { AssertThatForNumber } from './assertions/forNumbers/AssertThatForNumber'; -import { AssertThatForObject } from './assertions/forObjects/AssertThatForObject'; -import { AssertThatForResult } from './assertions/forResults/AssertThatForResult'; -import { AssertThatForSet } from './assertions/forSets/AssertThatForSet'; -import { AssertThatForString } from './assertions/forStrings/AssertThatForString'; -import { isResult } from 'defekt'; -import { getAssertionsForAny, getNegatedAssertionsForAny } from './assertions/forAny/assertions'; -import { getAssertionsForArray, getNegatedAssertionsForArray } from './assertions/forArrays/assertions'; -import { getAssertionsForFunction, getNegatedAssertionsForFunction } from './assertions/forFunctions/assertions'; -import { getAssertionsForMap, getNegatedAssertionsForMap } from './assertions/forMaps/assertions'; -import { getAssertionsForNumber, getNegatedAssertionsForNumber } from './assertions/forNumbers/assertions'; -import { getAssertionsForObject, getNegatedAssertionsForObject } from './assertions/forObjects/assertions'; -import { getAssertionsForResult, getNegatedAssertionsForResult } from './assertions/forResults/assertions'; -import { getAssertionsForSet, getNegatedAssertionsForSet } from './assertions/forSets/assertions'; -import { getAssertionsForString, getNegatedAssertionsForString } from './assertions/forStrings/assertions'; -import { isArray, isFunction, isMap, isNumber, isObject, isSet, isString } from 'typedescriptor'; +import { CombinedAssertions } from './assertions/combined/CombinedAssertions'; +import { + getCombinedAssertions, + getCombinedAssertionsForEach, + getNegatedCombinedAssertions, getNegatedCombinedAssertionsForEach +} from './assertions/combined/assertions'; -type AssertThat = - AssertThatForSet & - AssertThatForMap & - AssertThatForArray & - AssertThatForResult & - AssertThatForNumber & - AssertThatForString & - AssertThatForFunction & - AssertThatForObject & - AssertThatForAny; +type AssertThat = ((value: TValue) => ({ + is: CombinedAssertions & { + not: CombinedAssertions; + }; +})) & { + eachElementOf: (value: TValue) => TValue extends Set ? { + is: CombinedAssertions & { + not: CombinedAssertions; + }; + } : TValue extends Map ? { + is: CombinedAssertions & { + not: CombinedAssertions; + }; + } : TValue extends (infer TContent)[] ? { + is: CombinedAssertions & { + not: CombinedAssertions; + }; + } : never; +}; // eslint-disable-next-line consistent-this -const that: AssertThat = (actual: any): any => ({ - is: { - ...getAssertionsForAny(actual), +const that: AssertThat = function (actual: any): any { + return { + is: { + ...getCombinedAssertions(actual), + not: { + ...getNegatedCombinedAssertions(actual) + } + } + }; +}; - ...isSet(actual) ? getAssertionsForSet(actual) : {}, - ...isMap(actual) ? getAssertionsForMap(actual) : {}, - ...isArray(actual) ? getAssertionsForArray(actual) : {}, - ...isResult(actual) ? getAssertionsForResult(actual) : {}, - ...isNumber(actual) ? getAssertionsForNumber(actual) : {}, - ...isString(actual) ? getAssertionsForString(actual) : {}, - ...isFunction(actual) ? getAssertionsForFunction(actual) : {}, - ...isObject(actual) ? getAssertionsForObject(actual) : {}, +that.eachElementOf = (actualCollection: any): any => ({ + is: { + ...getCombinedAssertionsForEach(actualCollection), not: { - ...getNegatedAssertionsForAny(actual), - - ...isSet(actual) ? getNegatedAssertionsForSet(actual) : {}, - ...isMap(actual) ? getNegatedAssertionsForMap(actual) : {}, - ...isArray(actual) ? getNegatedAssertionsForArray(actual) : {}, - ...isResult(actual) ? getNegatedAssertionsForResult(actual) : {}, - ...isNumber(actual) ? getNegatedAssertionsForNumber(actual) : {}, - ...isString(actual) ? getNegatedAssertionsForString(actual) : {}, - ...isFunction(actual) ? getNegatedAssertionsForFunction(actual) : {}, - ...isObject(actual) ? getNegatedAssertionsForObject(actual) : {} + ...getNegatedCombinedAssertionsForEach(actualCollection) } } }); diff --git a/lib/comparisons/forErrors/compareErrors.ts b/lib/comparisons/forErrors/compareErrors.ts index 3efb53a..1f2dbd9 100644 --- a/lib/comparisons/forErrors/compareErrors.ts +++ b/lib/comparisons/forErrors/compareErrors.ts @@ -1,4 +1,5 @@ import { compareObjects } from '../forObjects/compareObjects'; +import { makeErrorLessShitty } from '../../types/LessShittyError'; import { equalDiff, EqualDiff, isEqualDiff } from '../../diffs/EqualDiff'; import { errorDiff, ErrorDiff } from '../../diffs/forErrors/ErrorDiff'; @@ -6,18 +7,16 @@ const compareErrors = function ( actual: Error, expected: Error ): ErrorDiff | EqualDiff { - const actualErrorButWithoutTheShittiness = { - ...actual, - message: actual.message - }; - const expectedErrorButWithoutTheShittiness = { - ...expected, - message: expected.message - }; + const actualLessShittyError = makeErrorLessShitty({ + error: actual + }); + const expectedLessShittyError = makeErrorLessShitty({ + error: expected + }); const objectDiff = compareObjects( - actualErrorButWithoutTheShittiness, - expectedErrorButWithoutTheShittiness + actualLessShittyError, + expectedLessShittyError ); if (isEqualDiff(objectDiff)) { diff --git a/lib/comparisons/forFunctions/compareFunctions.ts b/lib/comparisons/forFunctions/compareFunctions.ts index a0e9a9c..f7daf08 100644 --- a/lib/comparisons/forFunctions/compareFunctions.ts +++ b/lib/comparisons/forFunctions/compareFunctions.ts @@ -4,10 +4,8 @@ import { equalDiff, EqualDiff, isEqualDiff } from '../../diffs/EqualDiff'; import { functionDiff, FunctionDiff } from '../../diffs/forFunctions/FunctionDiff'; const compareFunctions = function ( -/* eslint-disable @typescript-eslint/ban-types */ - actual: Function, - expected: Function -/* eslint-enable @typescript-eslint/ban-types */ + actual: (...args: any[]) => any, + expected: (...args: any[]) => any ): FunctionDiff | EqualDiff { const actualStringRepresentation = actual.toString(); const expectedStringRepresentation = expected.toString(); diff --git a/lib/dispel/dispelError.ts b/lib/dispel/dispelError.ts index f4ed58a..b2d68ed 100644 --- a/lib/dispel/dispelError.ts +++ b/lib/dispel/dispelError.ts @@ -1,12 +1,13 @@ import { Ancestors } from './Ancestors'; import { dispel } from './dispel'; +import { makeErrorLessShitty } from '../types/LessShittyError'; import { recursion, Recursion } from '../types/Recursion'; -const dispelError = function ( - value: Error, +const dispelError = function ( + value: TError, path = '/', ancestors: Ancestors = [] -): Error | Recursion { +): TError | Recursion { for (const ancestor of ancestors) { if (value === ancestor.reference) { return recursion({ @@ -15,10 +16,9 @@ const dispelError = function ( } } - const errorButWithoutTheShittiness = { - ...value, - message: value.message - }; + const lessShittyError = makeErrorLessShitty({ + error: value + }); const newAncestors = [ ...ancestors, @@ -30,7 +30,7 @@ const dispelError = function ( const dispelledError = Object.create(value); - for (const [ key, property ] of Object.entries(errorButWithoutTheShittiness)) { + for (const [ key, property ] of Object.entries(lessShittyError)) { dispelledError[key] = dispel(property, `${path}${key}/`, newAncestors); } diff --git a/lib/dispel/dispelObject.ts b/lib/dispel/dispelObject.ts index 16adbd9..dca7668 100644 --- a/lib/dispel/dispelObject.ts +++ b/lib/dispel/dispelObject.ts @@ -6,7 +6,7 @@ const dispelObject = function ( value: object, path = '/', ancestors: Ancestors = [] -): any[] | Recursion { +): object | Recursion { for (const ancestor of ancestors) { if (value === ancestor.reference) { return recursion({ diff --git a/lib/prettyPrint/forErrors/prettyPrintError.ts b/lib/prettyPrint/forErrors/prettyPrintError.ts index e55a8c0..3dcbb50 100644 --- a/lib/prettyPrint/forErrors/prettyPrintError.ts +++ b/lib/prettyPrint/forErrors/prettyPrintError.ts @@ -1,13 +1,12 @@ +import { makeErrorLessShitty } from '../../types/LessShittyError'; import { prettyPrint } from '../typeAware/prettyPrint'; const prettyPrintError = function (error: Error, depth = 0): string { - const errorButWithoutTheShittiness = { - ...error, - message: error.message, - stack: error.stack - }; + const lessShittyError = makeErrorLessShitty({ + error + }); - return `Error(${prettyPrint(errorButWithoutTheShittiness, depth)})`; + return `Error(${prettyPrint(lessShittyError, depth)})`; }; export { diff --git a/lib/prettyPrint/forFunctions/prettyPrintFunction.ts b/lib/prettyPrint/forFunctions/prettyPrintFunction.ts index c28e1d5..7d06496 100644 --- a/lib/prettyPrint/forFunctions/prettyPrintFunction.ts +++ b/lib/prettyPrint/forFunctions/prettyPrintFunction.ts @@ -1,5 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/ban-types -const prettyPrintFunction = function (value: Function): string { +const prettyPrintFunction = function (value: (...args: any[]) => any): string { return `function ${value.name} (...) { ... }`; }; diff --git a/lib/size/forErrors/errorSize.ts b/lib/size/forErrors/errorSize.ts index 5c86bb5..668ed55 100644 --- a/lib/size/forErrors/errorSize.ts +++ b/lib/size/forErrors/errorSize.ts @@ -1,12 +1,12 @@ +import { makeErrorLessShitty } from '../../types/LessShittyError'; import { objectSize } from '../forObjects/objectSize'; const errorSize = function (value: TError): number { - const errorButWithoutTheShittiness = { - ...value, - message: value.message - }; + const lessShittyError = makeErrorLessShitty({ + error: value + }); - return objectSize(errorButWithoutTheShittiness); + return objectSize(lessShittyError); }; export { diff --git a/lib/types/LessShittyError.ts b/lib/types/LessShittyError.ts new file mode 100644 index 0000000..ebf16ac --- /dev/null +++ b/lib/types/LessShittyError.ts @@ -0,0 +1,20 @@ +interface LessShittyError { + message: string; +} + +const makeErrorLessShitty = function ({ error }: { + error: TError; +}): TError { + return { + ...error, + message: error.message + }; +}; + +export type { + LessShittyError +}; + +export { + makeErrorLessShitty +}; diff --git a/lib/wrapAssertionForIterable.ts b/lib/wrapAssertionForIterable.ts new file mode 100644 index 0000000..91d89ce --- /dev/null +++ b/lib/wrapAssertionForIterable.ts @@ -0,0 +1,59 @@ +import { AssertionFailed } from './errors'; +import { prettyPrint } from './prettyPrint/typeAware/prettyPrint'; +import { typeOf } from 'typedescriptor'; +import { error, Result, value } from 'defekt'; + +type Assertion = (actual: TValue, ...rest: TParams) => Result; + +const wrapAssertionForIterable = function ( + assertion: Assertion +): Assertion | Map, TParams> { + return (actual: TValue[] | Set | Map, ...params: TParams): Result => { + for (const [ index, item ] of actual.entries()) { + const result = assertion(item, ...params); + + if (result.hasError()) { + return error( + new AssertionFailed({ + message: `Assertion failed for item ${prettyPrint(index)} of the ${typeOf(actual)}.\n${result.error.message}`, + actual: result.error.data.actual, + expected: result.error.data.expected, + diff: result.error.data.diff + }) + ); + } + } + + return value(); + }; +}; + +type AsyncAssertion = (actual: TValue, ...rest: TParams) => Promise>; + +const wrapAsyncAssertionForIterable = function ( + assertion: AsyncAssertion +): AsyncAssertion | Map, TParams> { + return async (actual: TValue[] | Set | Map, ...params: TParams): Promise> => { + for (const [ index, item ] of actual.entries()) { + const result = await assertion(item, ...params); + + if (result.hasError()) { + return error( + new AssertionFailed({ + message: `Assertion failed for item ${prettyPrint(index)} of the ${typeOf(actual)}.\n${result.error.message}`, + actual: result.error.data.actual, + expected: result.error.data.expected, + diff: result.error.data.diff + }) + ); + } + } + + return value(); + }; +}; + +export { + wrapAssertionForIterable, + wrapAsyncAssertionForIterable +}; diff --git a/package-lock.json b/package-lock.json index 61ee85e..c28f482 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,21 +25,21 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "dependencies": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.16.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz", - "integrity": "sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", + "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", "dev": true, "peer": true, "engines": { @@ -47,21 +47,21 @@ } }, "node_modules/@babel/core": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.0.tgz", - "integrity": "sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", + "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", "dev": true, "peer": true, "dependencies": { - "@babel/code-frame": "^7.16.0", - "@babel/generator": "^7.16.0", - "@babel/helper-compilation-targets": "^7.16.0", - "@babel/helper-module-transforms": "^7.16.0", - "@babel/helpers": "^7.16.0", - "@babel/parser": "^7.16.0", - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.0", - "@babel/types": "^7.16.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -88,9 +88,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.16.3.tgz", - "integrity": "sha512-iB4ElZT0jAt7PKVaeVulOECdGe6UnmA/O0P9jlF5g5GBOwDVbna8AXhHRu4s27xQf6OkveyA8iTDv1jHdDejgQ==", + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.16.5.tgz", + "integrity": "sha512-mUqYa46lgWqHKQ33Q6LNCGp/wPR3eqOYTUixHFsfrSQqRxH0+WOzca75iEjFr5RDGH1dDz622LaHhLOzOuQRUA==", "dev": true, "peer": true, "dependencies": { @@ -127,12 +127,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz", - "integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", + "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", "dev": true, "dependencies": { - "@babel/types": "^7.16.0", + "@babel/types": "^7.16.8", "jsesc": "^2.5.1", "source-map": "^0.5.0" }, @@ -141,14 +141,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz", - "integrity": "sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", "dev": true, "peer": true, "dependencies": { - "@babel/compat-data": "^7.16.0", - "@babel/helper-validator-option": "^7.14.5", + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", "browserslist": "^4.17.5", "semver": "^6.3.0" }, @@ -169,157 +169,127 @@ "semver": "bin/semver.js" } }, - "node_modules/@babel/helper-function-name": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", - "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "node_modules/@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", "dev": true, "dependencies": { - "@babel/helper-get-function-arity": "^7.16.0", - "@babel/template": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", - "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "node_modules/@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", "dev": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", - "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "node_modules/@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", "dev": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz", - "integrity": "sha512-bsjlBFPuWT6IWhl28EdrQ+gTvSvj5tqVP5Xeftp07SEuz5pLnsXZuDkDD3Rfcxy0IsHmbZ+7B2/9SHzxO0T+sQ==", + "node_modules/@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", "dev": true, - "peer": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", - "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, "peer": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz", - "integrity": "sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/helper-module-imports": "^7.16.0", - "@babel/helper-replace-supers": "^7.16.0", - "@babel/helper-simple-access": "^7.16.0", - "@babel/helper-split-export-declaration": "^7.16.0", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.0", - "@babel/types": "^7.16.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", - "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", "dev": true, "peer": true, "dependencies": { - "@babel/types": "^7.16.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.0.tgz", - "integrity": "sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==", - "dev": true, - "peer": true, - "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.16.0", - "@babel/helper-optimise-call-expression": "^7.16.0", - "@babel/traverse": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", - "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", "dev": true, "peer": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", - "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", "dev": true, "peer": true, "engines": { @@ -327,27 +297,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.3.tgz", - "integrity": "sha512-Xn8IhDlBPhvYTvgewPKawhADichOsbkZuzN7qz2BusOM0brChsyXMDJvldWaYMMUNiCQdQzNEioXTp3sC8Nt8w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", + "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", "dev": true, "peer": true, "dependencies": { - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.3", - "@babel/types": "^7.16.0" + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -418,9 +388,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.16.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz", - "integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", + "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -430,32 +400,33 @@ } }, "node_modules/@babel/template": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", - "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.16.0", - "@babel/parser": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.3.tgz", - "integrity": "sha512-eolumr1vVMjqevCpwVO99yN/LoGL0EyHiLO5I043aYQvwOJ9eR5UsZSClHVCzfhBduMAsSzgA/6AyqPjNayJag==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.16.0", - "@babel/generator": "^7.16.0", - "@babel/helper-function-name": "^7.16.0", - "@babel/helper-hoist-variables": "^7.16.0", - "@babel/helper-split-export-declaration": "^7.16.0", - "@babel/parser": "^7.16.3", - "@babel/types": "^7.16.0", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", + "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -463,13 +434,22 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/@babel/types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", - "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", + "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "to-fast-properties": "^2.0.0" }, "engines": { @@ -517,51 +497,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@eslint/eslintrc/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", - "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", @@ -1338,17 +1273,17 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "peer": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" }, "engines": { @@ -1419,17 +1354,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "peer": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" }, "engines": { @@ -1754,13 +1689,10 @@ "dev": true }, "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "node_modules/argv-formatter": { "version": "1.0.0", @@ -1953,14 +1885,14 @@ "dev": true }, "node_modules/browserslist": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz", - "integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", "dev": true, "peer": true, "dependencies": { - "caniuse-lite": "^1.0.30001280", - "electron-to-chromium": "^1.3.896", + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", "escalade": "^3.1.1", "node-releases": "^2.0.1", "picocolors": "^1.0.0" @@ -2100,9 +2032,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001282", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001282.tgz", - "integrity": "sha512-YhF/hG6nqBEllymSIjLtR2iWDDnChvhnVJqp+vloyt2tEHFG1yBR+ac2B/rOw0qOK0m0lEXU2dv4E/sMk5P9Kg==", + "version": "1.0.30001300", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001300.tgz", + "integrity": "sha512-cVjiJHWGcNlJi8TZVKNMnvMid3Z3TTdDHmLDzlOdIiZq138Exvo0G+G0wTdVYolxKb4AYwC+38pxodiInVtJSA==", "dev": true, "peer": true, "funding": { @@ -2172,9 +2104,9 @@ } }, "node_modules/ci-info": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", - "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true, "peer": true }, @@ -2976,6 +2908,40 @@ "node": ">=10" } }, + "node_modules/depcheck/node_modules/@babel/parser": { + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz", + "integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/depcheck/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/depcheck/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", @@ -3082,9 +3048,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.904", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.904.tgz", - "integrity": "sha512-x5uZWXcVNYkTh4JubD7KSC1VMKz0vZwJUqVwY3ihsW0bst1BXDe494Uqbg3Y0fDGVjJqA8vEeGuvO5foyH2+qw==", + "version": "1.4.46", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.46.tgz", + "integrity": "sha512-UtV0xUA/dibCKKP2JMxOpDtXR74zABevuUEH4K0tvduFSIoxRVcYmQsbB51kXsFTX8MmOyWMt8tuZAlmDOqkrQ==", "dev": true, "peer": true }, @@ -3492,12 +3458,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/eslint/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -3535,45 +3495,6 @@ "node": ">=10.13.0" } }, - "node_modules/eslint/node_modules/globals": { - "version": "13.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", - "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/espree": { "version": "9.3.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", @@ -3917,20 +3838,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -4102,12 +4009,30 @@ } }, "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, "engines": { - "node": ">=4" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/globby": { @@ -4672,9 +4597,9 @@ } }, "node_modules/is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true, "peer": true, "engines": { @@ -4859,13 +4784,13 @@ } }, "node_modules/is-weakref": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", - "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, "peer": true, "dependencies": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4915,13 +4840,12 @@ "dev": true }, "node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" @@ -5539,12 +5463,6 @@ "url": "https://opencollective.com/mochajs" } }, - "node_modules/mocha/node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "node_modules/mocha/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -5573,18 +5491,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mocha/node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, "node_modules/mocha/node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -5700,9 +5606,9 @@ } }, "node_modules/mongodb-connection-string-url": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.4.2.tgz", - "integrity": "sha512-mZUXF6nUzRWk5J3h41MsPv13ukWlH4jOMSk6astVeoZ1EbdTJyF5I3wxKkvqBAOoVtzLgyEYUvDjrGdcPlKjAw==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz", + "integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==", "dev": true, "dependencies": { "@types/whatwg-url": "^8.2.1", @@ -5899,9 +5805,9 @@ } }, "node_modules/npm": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/npm/-/npm-8.4.0.tgz", - "integrity": "sha512-j32JsNpXI0TwuZd2p67X+U83lEqHrc0+CGIUGNwQqubMPj610+BongAfX0SmTCvyz7PzSIkxftuInNSmweF0hQ==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/npm/-/npm-8.4.1.tgz", + "integrity": "sha512-Br6GQ6MGF06MhgBNhAJ4heYsCO5NJDKXnwHGaBgNDFz6HZiEOhc+sDGEcoXki4IlSUuAFdLY66BWaFI7BasMCA==", "bundleDependencies": [ "@isaacs/string-locale-compare", "@npmcli/arborist", @@ -6098,16 +6004,16 @@ } }, "node_modules/npm-package-json-lint/node_modules/globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" }, "engines": { @@ -6222,13 +6128,16 @@ } }, "node_modules/npm/node_modules/@npmcli/fs": { - "version": "1.0.0", + "version": "1.1.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "@gar/promisify": "^1.0.1", "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" } }, "node_modules/npm/node_modules/@npmcli/git": { @@ -6650,19 +6559,18 @@ } }, "node_modules/npm/node_modules/cli-table3": { - "version": "0.6.0", + "version": "0.6.1", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "object-assign": "^4.1.0", "string-width": "^4.2.0" }, "engines": { "node": "10.* || >= 12.*" }, "optionalDependencies": { - "colors": "^1.1.2" + "colors": "1.4.0" } }, "node_modules/npm/node_modules/cli-table3/node_modules/ansi-regex": { @@ -6796,7 +6704,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/debug": { - "version": "4.3.2", + "version": "4.3.3", "dev": true, "inBundle": true, "license": "MIT", @@ -7016,7 +6924,7 @@ } }, "node_modules/npm/node_modules/graceful-fs": { - "version": "4.2.8", + "version": "4.2.9", "dev": true, "inBundle": true, "license": "ISC" @@ -7222,7 +7130,7 @@ } }, "node_modules/npm/node_modules/is-core-module": { - "version": "2.8.0", + "version": "2.8.1", "dev": true, "inBundle": true, "license": "MIT", @@ -7896,15 +7804,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16" } }, - "node_modules/npm/node_modules/object-assign": { - "version": "4.1.1", - "dev": true, - "inBundle": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/npm/node_modules/once": { "version": "1.4.0", "dev": true, @@ -8229,7 +8128,7 @@ } }, "node_modules/npm/node_modules/socks-proxy-agent": { - "version": "6.1.0", + "version": "6.1.1", "dev": true, "inBundle": true, "license": "MIT", @@ -8269,7 +8168,7 @@ } }, "node_modules/npm/node_modules/spdx-license-ids": { - "version": "3.0.10", + "version": "3.0.11", "dev": true, "inBundle": true, "license": "CC0-1.0" @@ -8488,12 +8387,12 @@ } }, "node_modules/npm/node_modules/wide-align": { - "version": "1.1.3", + "version": "1.1.5", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "string-width": "^1.0.2 || 2" + "string-width": "^1.0.2 || 2 || 3 || 4" } }, "node_modules/npm/node_modules/wrappy": { @@ -8534,9 +8433,9 @@ } }, "node_modules/object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true, "peer": true, "funding": { @@ -9063,15 +8962,15 @@ "dev": true }, "node_modules/prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "dev": true, "peer": true, "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", - "react-is": "^16.8.1" + "react-is": "^16.13.1" } }, "node_modules/punycode": { @@ -9308,9 +9207,9 @@ } }, "node_modules/regexp.prototype.flags": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz", - "integrity": "sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.1.tgz", + "integrity": "sha512-pMR7hBVUUGI7PMA37m2ofIdQCsomVnas+Jn5UPGAHQ+/LlwKm/aTLJHdasmHRzlfeZwHiAOaRSo2rbBDm3nNUQ==", "dev": true, "peer": true, "dependencies": { @@ -9621,12 +9520,6 @@ "tslib": "^2.1.0" } }, - "node_modules/rxjs/node_modules/tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", - "dev": true - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -10552,9 +10445,9 @@ } }, "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", "dev": true }, "node_modules/tsutils": { @@ -10572,6 +10465,12 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, + "node_modules/tsutils/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -10632,9 +10531,9 @@ } }, "node_modules/uglify-js": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.0.tgz", - "integrity": "sha512-x+xdeDWq7FiORDvyIJ0q/waWd4PhjBNOm5dQUOq2AKC0IEjxOS66Ha9tctiVDGcRQuh69K7fgU5oRuTK4cysSg==", + "version": "3.15.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.1.tgz", + "integrity": "sha512-FAGKF12fWdkpvNJZENacOH0e/83eG6JyVQyanIJaBXCN1J11TUQv1T1/z8S+Z0CG0ZPk1nPcreF/c7lrTd0TEQ==", "dev": true, "optional": true, "bin": { @@ -11075,37 +10974,37 @@ }, "dependencies": { "@babel/code-frame": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", - "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, "requires": { - "@babel/highlight": "^7.16.0" + "@babel/highlight": "^7.16.7" } }, "@babel/compat-data": { - "version": "7.16.4", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz", - "integrity": "sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", + "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", "dev": true, "peer": true }, "@babel/core": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.0.tgz", - "integrity": "sha512-mYZEvshBRHGsIAiyH5PzCFTCfbWfoYbO/jcSdXQSUQu1/pW0xDZAUP7KEc32heqWTAfAHhV9j1vH8Sav7l+JNQ==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", + "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", "dev": true, "peer": true, "requires": { - "@babel/code-frame": "^7.16.0", - "@babel/generator": "^7.16.0", - "@babel/helper-compilation-targets": "^7.16.0", - "@babel/helper-module-transforms": "^7.16.0", - "@babel/helpers": "^7.16.0", - "@babel/parser": "^7.16.0", - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.0", - "@babel/types": "^7.16.0", + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -11124,9 +11023,9 @@ } }, "@babel/eslint-parser": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.16.3.tgz", - "integrity": "sha512-iB4ElZT0jAt7PKVaeVulOECdGe6UnmA/O0P9jlF5g5GBOwDVbna8AXhHRu4s27xQf6OkveyA8iTDv1jHdDejgQ==", + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.16.5.tgz", + "integrity": "sha512-mUqYa46lgWqHKQ33Q6LNCGp/wPR3eqOYTUixHFsfrSQqRxH0+WOzca75iEjFr5RDGH1dDz622LaHhLOzOuQRUA==", "dev": true, "peer": true, "requires": { @@ -11152,25 +11051,25 @@ } }, "@babel/generator": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.0.tgz", - "integrity": "sha512-RR8hUCfRQn9j9RPKEVXo9LiwoxLPYn6hNZlvUOR8tSnaxlD0p0+la00ZP9/SnRt6HchKr+X0fO2r8vrETiJGew==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", + "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", "dev": true, "requires": { - "@babel/types": "^7.16.0", + "@babel/types": "^7.16.8", "jsesc": "^2.5.1", "source-map": "^0.5.0" } }, "@babel/helper-compilation-targets": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz", - "integrity": "sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", "dev": true, "peer": true, "requires": { - "@babel/compat-data": "^7.16.0", - "@babel/helper-validator-option": "^7.14.5", + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", "browserslist": "^4.17.5", "semver": "^6.3.0" }, @@ -11184,146 +11083,122 @@ } } }, - "@babel/helper-function-name": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", - "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", "dev": true, "requires": { - "@babel/helper-get-function-arity": "^7.16.0", - "@babel/template": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, - "@babel/helper-get-function-arity": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", - "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" } }, - "@babel/helper-hoist-variables": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", - "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, - "@babel/helper-member-expression-to-functions": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.0.tgz", - "integrity": "sha512-bsjlBFPuWT6IWhl28EdrQ+gTvSvj5tqVP5Xeftp07SEuz5pLnsXZuDkDD3Rfcxy0IsHmbZ+7B2/9SHzxO0T+sQ==", + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", "dev": true, - "peer": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-module-imports": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", - "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, "peer": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-module-transforms": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.0.tgz", - "integrity": "sha512-My4cr9ATcaBbmaEa8M0dZNA74cfI6gitvUAskgDtAFmAqyFKDSHQo5YstxPbN+lzHl2D9l/YOEFqb2mtUh4gfA==", - "dev": true, - "peer": true, - "requires": { - "@babel/helper-module-imports": "^7.16.0", - "@babel/helper-replace-supers": "^7.16.0", - "@babel/helper-simple-access": "^7.16.0", - "@babel/helper-split-export-declaration": "^7.16.0", - "@babel/helper-validator-identifier": "^7.15.7", - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.0", - "@babel/types": "^7.16.0" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", - "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", - "dev": true, - "peer": true, - "requires": { - "@babel/types": "^7.16.0" - } - }, - "@babel/helper-replace-supers": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.0.tgz", - "integrity": "sha512-TQxuQfSCdoha7cpRNJvfaYxxxzmbxXw/+6cS7V02eeDYyhxderSoMVALvwupA54/pZcOTtVeJ0xccp1nGWladA==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", "dev": true, "peer": true, "requires": { - "@babel/helper-member-expression-to-functions": "^7.16.0", - "@babel/helper-optimise-call-expression": "^7.16.0", - "@babel/traverse": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/helper-simple-access": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", - "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", "dev": true, "peer": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-split-export-declaration": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", - "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/types": "^7.16.7" } }, "@babel/helper-validator-identifier": { - "version": "7.15.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", - "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", "dev": true }, "@babel/helper-validator-option": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", - "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", "dev": true, "peer": true }, "@babel/helpers": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.3.tgz", - "integrity": "sha512-Xn8IhDlBPhvYTvgewPKawhADichOsbkZuzN7qz2BusOM0brChsyXMDJvldWaYMMUNiCQdQzNEioXTp3sC8Nt8w==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", + "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", "dev": true, "peer": true, "requires": { - "@babel/template": "^7.16.0", - "@babel/traverse": "^7.16.3", - "@babel/types": "^7.16.0" + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/highlight": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", - "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz", + "integrity": "sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -11381,46 +11256,55 @@ } }, "@babel/parser": { - "version": "7.16.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz", - "integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", + "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", "dev": true }, "@babel/template": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", - "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, "requires": { - "@babel/code-frame": "^7.16.0", - "@babel/parser": "^7.16.0", - "@babel/types": "^7.16.0" + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" } }, "@babel/traverse": { - "version": "7.16.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.3.tgz", - "integrity": "sha512-eolumr1vVMjqevCpwVO99yN/LoGL0EyHiLO5I043aYQvwOJ9eR5UsZSClHVCzfhBduMAsSzgA/6AyqPjNayJag==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.0", - "@babel/generator": "^7.16.0", - "@babel/helper-function-name": "^7.16.0", - "@babel/helper-hoist-variables": "^7.16.0", - "@babel/helper-split-export-declaration": "^7.16.0", - "@babel/parser": "^7.16.3", - "@babel/types": "^7.16.0", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", + "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", "debug": "^4.1.0", "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + } } }, "@babel/types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", - "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", + "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.15.7", + "@babel/helper-validator-identifier": "^7.16.7", "to-fast-properties": "^2.0.0" } }, @@ -11454,38 +11338,6 @@ "js-yaml": "^4.1.0", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "globals": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", - "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } } }, "@humanwhocodes/config-array": { @@ -12120,17 +11972,17 @@ } }, "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "peer": true, "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" } } @@ -12171,17 +12023,17 @@ }, "dependencies": { "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "peer": true, "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" } } @@ -12435,13 +12287,10 @@ "dev": true }, "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "argv-formatter": { "version": "1.0.0", @@ -12584,14 +12433,14 @@ "dev": true }, "browserslist": { - "version": "4.18.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz", - "integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", "dev": true, "peer": true, "requires": { - "caniuse-lite": "^1.0.30001280", - "electron-to-chromium": "^1.3.896", + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", "escalade": "^3.1.1", "node-releases": "^2.0.1", "picocolors": "^1.0.0" @@ -12679,9 +12528,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001282", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001282.tgz", - "integrity": "sha512-YhF/hG6nqBEllymSIjLtR2iWDDnChvhnVJqp+vloyt2tEHFG1yBR+ac2B/rOw0qOK0m0lEXU2dv4E/sMk5P9Kg==", + "version": "1.0.30001300", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001300.tgz", + "integrity": "sha512-cVjiJHWGcNlJi8TZVKNMnvMid3Z3TTdDHmLDzlOdIiZq138Exvo0G+G0wTdVYolxKb4AYwC+38pxodiInVtJSA==", "dev": true, "peer": true }, @@ -12727,9 +12576,9 @@ } }, "ci-info": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.2.0.tgz", - "integrity": "sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.3.0.tgz", + "integrity": "sha512-riT/3vI5YpVH6/qomlDnJow6TBee2PBKSEpx3O32EGPYbWGIRsIlGRms3Sm74wYE1JMo8RnO04Hb12+v1J5ICw==", "dev": true, "peer": true }, @@ -13354,6 +13203,33 @@ "scss-parser": "^1.0.4", "semver": "^7.3.2", "yargs": "^16.1.0" + }, + "dependencies": { + "@babel/parser": { + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.4.tgz", + "integrity": "sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + } } }, "deprecation": { @@ -13449,9 +13325,9 @@ } }, "electron-to-chromium": { - "version": "1.3.904", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.904.tgz", - "integrity": "sha512-x5uZWXcVNYkTh4JubD7KSC1VMKz0vZwJUqVwY3ihsW0bst1BXDe494Uqbg3Y0fDGVjJqA8vEeGuvO5foyH2+qw==", + "version": "1.4.46", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.46.tgz", + "integrity": "sha512-UtV0xUA/dibCKKP2JMxOpDtXR74zABevuUEH4K0tvduFSIoxRVcYmQsbB51kXsFTX8MmOyWMt8tuZAlmDOqkrQ==", "dev": true, "peer": true }, @@ -13577,12 +13453,6 @@ "v8-compile-cache": "^2.0.3" }, "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -13607,30 +13477,6 @@ "requires": { "is-glob": "^4.0.3" } - }, - "globals": { - "version": "13.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", - "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true } } }, @@ -14083,13 +13929,6 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -14233,10 +14072,21 @@ } }, "globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + }, + "dependencies": { + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } }, "globby": { "version": "13.1.1", @@ -14638,9 +14488,9 @@ "dev": true }, "is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", "dev": true, "peer": true }, @@ -14756,13 +14606,13 @@ "dev": true }, "is-weakref": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", - "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, "peer": true, "requires": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2" } }, "isarray": { @@ -14803,13 +14653,12 @@ "dev": true }, "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" } }, "jsesc": { @@ -15281,12 +15130,6 @@ "yargs-unparser": "2.0.0" }, "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, "escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -15303,15 +15146,6 @@ "path-exists": "^4.0.0" } }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -15391,9 +15225,9 @@ } }, "mongodb-connection-string-url": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.4.2.tgz", - "integrity": "sha512-mZUXF6nUzRWk5J3h41MsPv13ukWlH4jOMSk6astVeoZ1EbdTJyF5I3wxKkvqBAOoVtzLgyEYUvDjrGdcPlKjAw==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz", + "integrity": "sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA==", "dev": true, "requires": { "@types/whatwg-url": "^8.2.1", @@ -15550,9 +15384,9 @@ "dev": true }, "npm": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/npm/-/npm-8.4.0.tgz", - "integrity": "sha512-j32JsNpXI0TwuZd2p67X+U83lEqHrc0+CGIUGNwQqubMPj610+BongAfX0SmTCvyz7PzSIkxftuInNSmweF0hQ==", + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/npm/-/npm-8.4.1.tgz", + "integrity": "sha512-Br6GQ6MGF06MhgBNhAJ4heYsCO5NJDKXnwHGaBgNDFz6HZiEOhc+sDGEcoXki4IlSUuAFdLY66BWaFI7BasMCA==", "dev": true, "requires": { "@isaacs/string-locale-compare": "*", @@ -15703,7 +15537,7 @@ } }, "@npmcli/fs": { - "version": "1.0.0", + "version": "1.1.0", "bundled": true, "dev": true, "requires": { @@ -16016,12 +15850,11 @@ } }, "cli-table3": { - "version": "0.6.0", + "version": "0.6.1", "bundled": true, "dev": true, "requires": { - "colors": "^1.1.2", - "object-assign": "^4.1.0", + "colors": "1.4.0", "string-width": "^4.2.0" }, "dependencies": { @@ -16117,7 +15950,7 @@ "dev": true }, "debug": { - "version": "4.3.2", + "version": "4.3.3", "bundled": true, "dev": true, "requires": { @@ -16275,7 +16108,7 @@ } }, "graceful-fs": { - "version": "4.2.8", + "version": "4.2.9", "bundled": true, "dev": true }, @@ -16421,7 +16254,7 @@ } }, "is-core-module": { - "version": "2.8.0", + "version": "2.8.1", "bundled": true, "dev": true, "requires": { @@ -16906,11 +16739,6 @@ "set-blocking": "^2.0.0" } }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true - }, "once": { "version": "1.4.0", "bundled": true, @@ -17126,7 +16954,7 @@ } }, "socks-proxy-agent": { - "version": "6.1.0", + "version": "6.1.1", "bundled": true, "dev": true, "requires": { @@ -17159,7 +16987,7 @@ } }, "spdx-license-ids": { - "version": "3.0.10", + "version": "3.0.11", "bundled": true, "dev": true }, @@ -17317,11 +17145,11 @@ } }, "wide-align": { - "version": "1.1.3", + "version": "1.1.5", "bundled": true, "dev": true, "requires": { - "string-width": "^1.0.2 || 2" + "string-width": "^1.0.2 || 2 || 3 || 4" } }, "wrappy": { @@ -17371,16 +17199,16 @@ }, "dependencies": { "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" } } @@ -17410,9 +17238,9 @@ "peer": true }, "object-inspect": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", - "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", "dev": true, "peer": true }, @@ -17790,15 +17618,15 @@ "dev": true }, "prop-types": { - "version": "15.7.2", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", - "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "dev": true, "peer": true, "requires": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", - "react-is": "^16.8.1" + "react-is": "^16.13.1" } }, "punycode": { @@ -17978,9 +17806,9 @@ "peer": true }, "regexp.prototype.flags": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz", - "integrity": "sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.1.tgz", + "integrity": "sha512-pMR7hBVUUGI7PMA37m2ofIdQCsomVnas+Jn5UPGAHQ+/LlwKm/aTLJHdasmHRzlfeZwHiAOaRSo2rbBDm3nNUQ==", "dev": true, "peer": true, "requires": { @@ -18191,14 +18019,6 @@ "dev": true, "requires": { "tslib": "^2.1.0" - }, - "dependencies": { - "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", - "dev": true - } } }, "safe-buffer": { @@ -18932,9 +18752,9 @@ } }, "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==", "dev": true }, "tsutils": { @@ -18944,6 +18764,14 @@ "dev": true, "requires": { "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } } }, "type-check": { @@ -18989,9 +18817,9 @@ "dev": true }, "uglify-js": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.0.tgz", - "integrity": "sha512-x+xdeDWq7FiORDvyIJ0q/waWd4PhjBNOm5dQUOq2AKC0IEjxOS66Ha9tctiVDGcRQuh69K7fgU5oRuTK4cysSg==", + "version": "3.15.1", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.1.tgz", + "integrity": "sha512-FAGKF12fWdkpvNJZENacOH0e/83eG6JyVQyanIJaBXCN1J11TUQv1T1/z8S+Z0CG0ZPk1nPcreF/c7lrTd0TEQ==", "dev": true, "optional": true }, diff --git a/test/integration/assertthatTests.ts b/test/integration/assertthatTests.ts new file mode 100644 index 0000000..de5c890 --- /dev/null +++ b/test/integration/assertthatTests.ts @@ -0,0 +1,316 @@ +import { assert } from '../../lib'; +import { error, value } from 'defekt'; + +suite(`assertthat's types allow the required assertions on each type`, (): void => { + suite('any', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = 'foo'; + + assert.that(aValue).is.equalTo('foo'); + assert.that(aValue).is.identicalTo('foo'); + assert.that(aValue).is.sameJsonAs('foo'); + assert.that('').is.falsy(); + assert.that(aValue).is.truthy(); + assert.that(null).is.null(); + // eslint-disable-next-line unicorn/no-useless-undefined + assert.that(undefined).is.undefined(); + assert.that(true).is.true(); + assert.that(false).is.false(); + assert.that(aValue).is.ofType('string'); + + assert.that(aValue).is.not.equalTo('bar'); + assert.that(aValue).is.not.identicalTo('bar'); + assert.that(aValue).is.not.sameJsonAs('bar'); + assert.that(aValue).is.not.falsy(); + assert.that('').is.not.truthy(); + assert.that(aValue).is.not.null(); + assert.that(aValue).is.not.undefined(); + assert.that(aValue).is.not.true(); + assert.that(aValue).is.not.false(); + assert.that(aValue).is.not.ofType('number'); + + assert.that.eachElementOf([ 'foo', 'foo' ]).is.equalTo('foo'); + assert.that.eachElementOf([ 'foo', 'foo' ]).is.identicalTo('foo'); + assert.that.eachElementOf([ 'foo', 'foo' ]).is.sameJsonAs('foo'); + assert.that.eachElementOf([ '', false, undefined ]).is.falsy(); + assert.that.eachElementOf([ true, 'foo', 5 ]).is.truthy(); + assert.that.eachElementOf([ null, null ]).is.null(); + assert.that.eachElementOf([ undefined, undefined ]).is.undefined(); + assert.that.eachElementOf([ true, true ]).is.true(); + assert.that.eachElementOf([ false, false ]).is.false(); + assert.that.eachElementOf([ 'foo', 'bar' ]).is.ofType('string'); + + assert.that.eachElementOf([ 'foo', 'notbar' ]).is.not.equalTo('bar'); + assert.that.eachElementOf([ 'foo', 'notbar' ]).is.not.identicalTo('bar'); + assert.that.eachElementOf([ 'foo', 'notbar' ]).is.not.sameJsonAs('bar'); + assert.that.eachElementOf([ true, 'foo', 5 ]).is.not.falsy(); + assert.that.eachElementOf([ '', false, undefined ]).is.not.truthy(); + assert.that.eachElementOf([ true, 'foo', 5 ]).is.not.null(); + assert.that.eachElementOf([ true, 'foo', 5 ]).is.not.undefined(); + assert.that.eachElementOf([ false, null ]).is.not.true(); + assert.that.eachElementOf([ true, null ]).is.not.false(); + assert.that.eachElementOf([ 'foo', false, {}]).is.not.ofType('number'); + }); + }); + + suite('set', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = new Set([ + 'foo' + ]); + + assert.that(aValue).is.containing('foo'); + assert.that(aValue).is.containingAllOf([ 'foo' ]); + assert.that(aValue).is.containingAnyOf([ 'foo' ]); + assert.that(aValue).is.atLeast(new Set()); + assert.that(aValue).is.atMost(new Set([ 'foo', 'bar' ])); + assert.that(new Set()).is.empty(); + + assert.that(aValue).is.not.containing('bar'); + assert.that(aValue).is.not.containingAllOf([ 'bar' ]); + assert.that(aValue).is.not.containingAnyOf([ 'bar' ]); + assert.that(aValue).is.not.atLeast(new Set([ 'bar' ])); + assert.that(aValue).is.not.atMost(new Set([])); + assert.that(aValue).is.not.empty(); + + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'foo' ]) ]).is.containing('foo'); + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'foo' ]) ]).is.containingAllOf([ 'foo' ]); + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'foo' ]) ]).is.containingAnyOf([ 'foo' ]); + assert.that.eachElementOf([ new Set(), new Set() ]).is.atLeast(new Set()); + assert.that.eachElementOf([ new Set(), new Set() ]).is.atMost(new Set([ 'foo', 'bar' ])); + assert.that.eachElementOf([ new Set(), new Set() ]).is.empty(); + + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'foo' ]) ]).is.not.containing('bar'); + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'foo' ]) ]).is.not.containingAllOf([ 'bar' ]); + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'foo' ]) ]).is.not.containingAnyOf([ 'bar' ]); + assert.that.eachElementOf([ new Set() ]).is.not.atLeast(new Set([ 'bar' ])); + assert.that.eachElementOf([ new Set([ 'anything' ]) ]).is.not.atMost(new Set([])); + assert.that.eachElementOf([ new Set([ 'foo' ]), new Set([ 'bar' ]) ]).is.not.empty(); + }); + }); + + suite('map', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = new Map(); + + aValue.set(5, 'foo'); + + assert.that(aValue).is.atLeast(new Map()); + assert.that(aValue).is.atMost(aValue); + assert.that(new Set()).is.empty(); + + assert.that(aValue).is.not.atLeast(new Map([[ 5, 'bar' ], [ 6, 'foo' ]])); + assert.that(aValue).is.not.atMost(new Map()); + assert.that(aValue).is.not.empty(); + + assert.that.eachElementOf([ new Map([[ 'foo', 'bar' ]]), new Map([[ 'bar', 'foo' ]]) ]).is.atLeast(new Map()); + assert.that.eachElementOf([ new Map(), new Map([[ 'foo', 'bar' ]]) ]).is.atMost(new Map([[ 'foo', 'bar' ]])); + assert.that.eachElementOf([ new Map(), new Map() ]).is.empty(); + + assert.that.eachElementOf([ new Map([[ 'foo', 'bar' ]]), new Map() ]).is.not.atLeast(new Map([[ 5, 'bar' ], [ 6, 'foo' ]])); + assert.that.eachElementOf([ new Map([[ 'foo', 'bar' ]]), new Map([[ 'bar', 'foo' ]]) ]).is.not.atMost(new Map()); + assert.that.eachElementOf([ new Map([[ 'foo', 'bar' ]]), new Map([[ 'bar', 'foo' ]]) ]).is.not.empty(); + }); + }); + + suite('array', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = [ 'foo' ]; + + assert.that(aValue).is.containing('foo'); + assert.that(aValue).is.containingAllOf([ 'foo' ]); + assert.that(aValue).is.containingAnyOf([ 'foo' ]); + assert.that([]).is.empty(); + + assert.that(aValue).is.not.containing('bar'); + assert.that(aValue).is.not.containingAllOf([ 'bar' ]); + assert.that(aValue).is.not.containingAnyOf([ 'bar' ]); + assert.that(aValue).is.not.empty(); + + assert.that.eachElementOf([[ 'foo', 'bar' ], [ 'bar', 'foo' ]]).is.containing('foo'); + assert.that.eachElementOf([[ 'foo', 'bar' ], [ 'bar', 'foo' ]]).is.containingAllOf([ 'foo' ]); + assert.that.eachElementOf([[ 'foo' ], [ 'bar' ]]).is.containingAnyOf([ 'foo', 'bar' ]); + assert.that.eachElementOf([[], []]).is.empty(); + + assert.that.eachElementOf([[ 'foo' ], []]).is.not.containing('bar'); + assert.that.eachElementOf([[ 'foo' ], []]).is.not.containingAllOf([ 'bar' ]); + assert.that.eachElementOf([[ 'foo' ], []]).is.not.containingAnyOf([ 'bar' ]); + assert.that.eachElementOf([[ 'foo' ], [ 'bar' ]]).is.not.empty(); + }); + }); + + suite('result', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = value(); + const anError = error(new Error('Foo.')); + + assert.that(aValue).is.aValue(); + assert.that(anError).is.anError(); + assert.that(anError).is.anErrorWithMessage('Foo.'); + + assert.that(anError).is.not.aValue(); + assert.that(aValue).is.not.anError(); + assert.that(aValue).is.not.anErrorWithMessage('Foo.'); + + assert.that.eachElementOf([ value('foo'), value(5) ]).is.aValue(); + assert.that.eachElementOf([ error(new Error('Foo.')), error(new Error('Bar.')) ]).is.anError(); + assert.that.eachElementOf([ error(new Error('Foo.')), error(new Error('Foo.')) ]).is.anErrorWithMessage('Foo.'); + + assert.that.eachElementOf([ error(new Error('Foo.')), error(new Error('Bar.')) ]).is.not.aValue(); + assert.that.eachElementOf([ value(5), value('foo') ]).is.not.anError(); + assert.that.eachElementOf([ value(5), error(new Error('Bar.')) ]).is.not.anErrorWithMessage('Foo.'); + }); + }); + + suite('number', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = 5; + + assert.that(aValue).is.greaterThan(4); + assert.that(aValue).is.lessThan(6); + assert.that(aValue).is.atLeast(5); + assert.that(aValue).is.atMost(5); + // eslint-disable-next-line new-cap + assert.that(Number.NaN).is.NaN(); + + assert.that(aValue).is.not.greaterThan(5); + assert.that(aValue).is.not.lessThan(5); + assert.that(aValue).is.not.atLeast(6); + assert.that(aValue).is.not.atMost(4); + // eslint-disable-next-line new-cap + assert.that(aValue).is.not.NaN(); + + assert.that.eachElementOf([ 5, 8 ]).is.greaterThan(4); + assert.that.eachElementOf([ 3, 5 ]).is.lessThan(6); + assert.that.eachElementOf([ 5, 8 ]).is.atLeast(5); + assert.that.eachElementOf([ 3, 5 ]).is.atMost(5); + // eslint-disable-next-line new-cap + assert.that.eachElementOf([ Number.NaN, Number.NaN ]).is.NaN(); + + assert.that.eachElementOf([ 3, 5 ]).is.not.greaterThan(5); + assert.that.eachElementOf([ 5, 8 ]).is.not.lessThan(5); + assert.that.eachElementOf([ 3, 5 ]).is.not.atLeast(6); + assert.that.eachElementOf([ 5, 8 ]).is.not.atMost(4); + // eslint-disable-next-line new-cap + assert.that.eachElementOf([ 5, 8 ]).is.not.NaN(); + }); + }); + + suite('string', (): void => { + test('can assert all relevant things.', async (): Promise => { + const aValue = 'foo'; + + assert.that(aValue).is.containing('fo'); + assert.that(aValue).is.startingWith('fo'); + assert.that(aValue).is.endingWith('oo'); + assert.that(aValue).is.containingAllOf([ 'f', 'o' ]); + assert.that(aValue).is.containingAnyOf([ 'f', 'x' ]); + assert.that('').is.empty(); + assert.that(aValue).is.matching(/foo/u); + + assert.that(aValue).is.not.containing('bar'); + assert.that(aValue).is.not.startingWith('bar'); + assert.that(aValue).is.not.endingWith('bar'); + assert.that(aValue).is.not.containingAllOf([ 'b', 'f' ]); + assert.that(aValue).is.not.containingAnyOf([ 'b', 'a' ]); + assert.that(aValue).is.not.empty(); + assert.that(aValue).is.not.matching(/bar/u); + + assert.that.eachElementOf([ 'foo', 'bafo', 'fob' ]).is.containing('fo'); + assert.that.eachElementOf([ 'foo', 'foobar' ]).is.startingWith('fo'); + assert.that.eachElementOf([ 'foo', 'boo' ]).is.endingWith('oo'); + assert.that.eachElementOf([ 'fo', 'of', 'wow even this contains all relevant letters f' ]).is.containingAllOf([ 'f', 'o' ]); + assert.that.eachElementOf([ 'foo', 'xxx' ]).is.containingAnyOf([ 'f', 'x' ]); + assert.that.eachElementOf([ '', '' ]).is.empty(); + assert.that.eachElementOf([ 'foo', 'foobar' ]).is.matching(/foo/u); + + assert.that.eachElementOf([ 'foo', 'bfaoro' ]).is.not.containing('bar'); + assert.that.eachElementOf([ 'foo', 'foobar' ]).is.not.startingWith('bar'); + assert.that.eachElementOf([ 'foo', 'barfoo' ]).is.not.endingWith('bar'); + assert.that.eachElementOf([ 'boo', 'far' ]).is.not.containingAllOf([ 'b', 'f' ]); + assert.that.eachElementOf([ 'foo', 'heck' ]).is.not.containingAnyOf([ 'b', 'a' ]); + assert.that.eachElementOf([ 'not', 'empty' ]).is.not.empty(); + assert.that.eachElementOf([ 'foo', 'bam' ]).is.not.matching(/bar/u); + }); + }); + + suite('function', (): void => { + test('can assert all relevant things.', async (): Promise => { + assert.that((): void => { + throw new Error('Foo.'); + }).is.throwing(); + await assert.that(async (): Promise => { + throw new Error('Foo.'); + }).is.throwingAsync(); + + assert.that((): void => { + // Empty function. + }).is.not.throwing(); + await assert.that(async (): Promise => { + // Empty function. + }).is.not.throwingAsync(); + + assert.that.eachElementOf([ + (): void => { + throw new Error('Foo.'); + }, + (): void => { + throw new Error('Bar.'); + } + ]).is.throwing(); + await assert.that.eachElementOf([ + async (): Promise => { + throw new Error('Foo.'); + }, + async (): Promise => { + throw new Error('Bar.'); + } + ]).is.throwingAsync(); + + assert.that.eachElementOf([ + (): void => { + // Empty function. + }, + (): number => 5 + ]).is.not.throwing(); + await assert.that.eachElementOf([ + async (): Promise => { + // Empty function. + }, + async (): Promise => 5 + ]).is.not.throwingAsync(); + }); + }); + + suite('object', (): void => { + class Foo { + public foo: string; + + public constructor () { + this.foo = 'foo'; + } + } + + const aValue = new Foo(); + + assert.that(aValue).is.atLeast({}); + assert.that(aValue).is.atMost({ foo: 'foo', bar: 'bar' }); + assert.that(aValue).is.instanceOf(Foo); + assert.that({}).is.empty(); + + assert.that(aValue).is.not.atLeast({ bar: 'bar' }); + assert.that(aValue).is.not.atMost({}); + assert.that(aValue).is.not.instanceOf(Array); + assert.that(aValue).is.not.empty(); + + assert.that.eachElementOf([{ foo: 'bar' }, { foo: 5 }]).is.atLeast({}); + assert.that.eachElementOf([{ foo: 'foo' }, {}]).is.atMost({ foo: 'foo', bar: 'bar' }); + assert.that.eachElementOf([ new Foo(), new Foo() ]).is.instanceOf(Foo); + assert.that.eachElementOf([{}, {}]).is.empty(); + + assert.that.eachElementOf([{ foo: 'foo' }, {}]).is.not.atLeast({ bar: 'bar' }); + assert.that.eachElementOf([{ foo: 'foo' }, { bar: 5 }]).is.not.atMost({}); + assert.that.eachElementOf([{ foo: 'foo' }, { bar: 'bar' }]).is.not.instanceOf(Array); + assert.that.eachElementOf([{ foo: 'foo' }, { bar: 'bar' }]).is.not.empty(); + }); +}); diff --git a/test/unit/assertions/forAny/assertActualIsEqualToExpectedTests.ts b/test/unit/assertions/forAny/assertActualIsEqualToExpectedTests.ts index 9650990..975e71a 100644 --- a/test/unit/assertions/forAny/assertActualIsEqualToExpectedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsEqualToExpectedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsEqualToExpected } from '../../../../lib/assertions/forAny/assertActualIsEqualToExpected'; +import { assertAnyIsEqualToExpected } from '../../../../lib/assertions/forAny/assertAnyIsEqualToExpected'; import { AssertionFailed } from '../../../../lib/errors'; import { compare } from '../../../../lib/comparisons/typeAware/compare'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; @@ -26,7 +26,7 @@ suite('assertActualIsEqualToExpected', (): void => { }; assert.that( - assertActualIsEqualToExpected(actual, expected) + assertAnyIsEqualToExpected(actual, expected) ).is.equalTo( value() ); @@ -51,7 +51,7 @@ suite('assertActualIsEqualToExpected', (): void => { }; assert.that( - assertActualIsEqualToExpected(actual, expected) + assertAnyIsEqualToExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values are not equal.', @@ -68,7 +68,7 @@ suite('assertActualIsEqualToExpected', (): void => { const expected = {}; assert.that( - assertActualIsEqualToExpected(actual, expected) + assertAnyIsEqualToExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values are not equal.', diff --git a/test/unit/assertions/forAny/assertActualIsFalseTests.ts b/test/unit/assertions/forAny/assertActualIsFalseTests.ts index a105112..caedd41 100644 --- a/test/unit/assertions/forAny/assertActualIsFalseTests.ts +++ b/test/unit/assertions/forAny/assertActualIsFalseTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib/assertthat'; -import { assertActualIsFalse } from '../../../../lib/assertions/forAny/assertActualIsFalse'; +import { assertAnyIsFalse } from '../../../../lib/assertions/forAny/assertAnyIsFalse'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -7,13 +7,13 @@ suite('assertActualIsFalse', (): void => { test('does not return an error if actual is false.', async (): Promise => { const actual = false; - assert.that(assertActualIsFalse(actual)).is.equalTo(value()); + assert.that(assertAnyIsFalse(actual)).is.equalTo(value()); }); test('returns an error if actual is not false.', async (): Promise => { const actual = true; - assert.that(assertActualIsFalse(actual)).is.equalTo(error(new AssertionFailed({ + assert.that(assertAnyIsFalse(actual)).is.equalTo(error(new AssertionFailed({ message: 'The value is not false.' }))); }); diff --git a/test/unit/assertions/forAny/assertActualIsFalsyTests.ts b/test/unit/assertions/forAny/assertActualIsFalsyTests.ts index 64e4ba1..d710535 100644 --- a/test/unit/assertions/forAny/assertActualIsFalsyTests.ts +++ b/test/unit/assertions/forAny/assertActualIsFalsyTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsFalsy } from '../../../../lib/assertions/forAny/assertActualIsFalsy'; +import { assertAnyIsFalsy } from '../../../../lib/assertions/forAny/assertAnyIsFalsy'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsFalsy', (): void => { const actual = 0; assert.that( - assertActualIsFalsy(actual) + assertAnyIsFalsy(actual) ).is.equalTo( value() ); @@ -19,7 +19,7 @@ suite('assertActualIsFalsy', (): void => { const actual = 15; assert.that( - assertActualIsFalsy(actual) + assertAnyIsFalsy(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is not falsy.', diff --git a/test/unit/assertions/forAny/assertActualIsIdenticalToExpectedTests.ts b/test/unit/assertions/forAny/assertActualIsIdenticalToExpectedTests.ts index 57e024c..237bd4e 100644 --- a/test/unit/assertions/forAny/assertActualIsIdenticalToExpectedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsIdenticalToExpectedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib/assertthat'; -import { assertActualIsIdenticalToExpected } from '../../../../lib/assertions/forAny/assertActualIsIdenticalToExpected'; +import { assertAnyIsIdenticalToExpected } from '../../../../lib/assertions/forAny/assertAnyIsIdenticalToExpected'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsIdenticalToExpected', (): void => { const expected = actual; assert.that( - assertActualIsIdenticalToExpected(actual, expected) + assertAnyIsIdenticalToExpected(actual, expected) ).is.equalTo( value() ); @@ -20,7 +20,7 @@ suite('assertActualIsIdenticalToExpected', (): void => { const expected = {}; assert.that( - assertActualIsIdenticalToExpected(actual, expected) + assertAnyIsIdenticalToExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values are not identical.' diff --git a/test/unit/assertions/forAny/assertActualIsNotEqualToExpectedTests.ts b/test/unit/assertions/forAny/assertActualIsNotEqualToExpectedTests.ts index 2573f72..a86ea15 100644 --- a/test/unit/assertions/forAny/assertActualIsNotEqualToExpectedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotEqualToExpectedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotEqualToExpected } from '../../../../lib/assertions/forAny/assertActualIsNotEqualToExpected'; +import { assertAnyIsNotEqualToExpected } from '../../../../lib/assertions/forAny/assertAnyIsNotEqualToExpected'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -24,7 +24,7 @@ suite('assertActualIsNotEqualToExpected', (): void => { }; assert.that( - assertActualIsNotEqualToExpected(actual, expected) + assertAnyIsNotEqualToExpected(actual, expected) ).is.equalTo( value() ); @@ -49,7 +49,7 @@ suite('assertActualIsNotEqualToExpected', (): void => { }; assert.that( - assertActualIsNotEqualToExpected(actual, expected) + assertAnyIsNotEqualToExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values are equal.', diff --git a/test/unit/assertions/forAny/assertActualIsNotFalseTests.ts b/test/unit/assertions/forAny/assertActualIsNotFalseTests.ts index 91ec8af..fbc1ed6 100644 --- a/test/unit/assertions/forAny/assertActualIsNotFalseTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotFalseTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib/assertthat'; -import { assertActualIsNotFalse } from '../../../../lib/assertions/forAny/assertActualIsNotFalse'; +import { assertAnyIsNotFalse } from '../../../../lib/assertions/forAny/assertAnyIsNotFalse'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -7,13 +7,13 @@ suite('assertActualIsNotFalse', (): void => { test('does not return an error if actual is not false.', async (): Promise => { const actual = true; - assert.that(assertActualIsNotFalse(actual)).is.equalTo(value()); + assert.that(assertAnyIsNotFalse(actual)).is.equalTo(value()); }); test('returns an error if actual is false.', async (): Promise => { const actual = false; - assert.that(assertActualIsNotFalse(actual)).is.equalTo(error(new AssertionFailed({ + assert.that(assertAnyIsNotFalse(actual)).is.equalTo(error(new AssertionFailed({ message: 'The value is false.' }))); }); diff --git a/test/unit/assertions/forAny/assertActualIsNotFalsyTests.ts b/test/unit/assertions/forAny/assertActualIsNotFalsyTests.ts index 4386fca..ada46fd 100644 --- a/test/unit/assertions/forAny/assertActualIsNotFalsyTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotFalsyTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotFalsy } from '../../../../lib/assertions/forAny/assertActualIsNotFalsy'; +import { assertAnyIsNotFalsy } from '../../../../lib/assertions/forAny/assertAnyIsNotFalsy'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsNotFalsy', (): void => { const actual = 15; assert.that( - assertActualIsNotFalsy(actual) + assertAnyIsNotFalsy(actual) ).is.equalTo( value() ); @@ -19,7 +19,7 @@ suite('assertActualIsNotFalsy', (): void => { const actual = 0; assert.that( - assertActualIsNotFalsy(actual) + assertAnyIsNotFalsy(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is falsy.', diff --git a/test/unit/assertions/forAny/assertActualIsNotIdenticalToExpectedTests.ts b/test/unit/assertions/forAny/assertActualIsNotIdenticalToExpectedTests.ts index 13d13a2..cd69123 100644 --- a/test/unit/assertions/forAny/assertActualIsNotIdenticalToExpectedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotIdenticalToExpectedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib/assertthat'; -import { assertActualIsNotIdenticalToExpected } from '../../../../lib/assertions/forAny/assertActualIsNotIdenticalToExpected'; +import { assertAnyIsNotIdenticalToExpected } from '../../../../lib/assertions/forAny/assertAnyIsNotIdenticalToExpected'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsNotIdenticalToExpected', (): void => { const expected = {}; assert.that( - assertActualIsNotIdenticalToExpected(actual, expected) + assertAnyIsNotIdenticalToExpected(actual, expected) ).is.equalTo( value() ); @@ -20,7 +20,7 @@ suite('assertActualIsNotIdenticalToExpected', (): void => { const expected = actual; assert.that( - assertActualIsNotIdenticalToExpected(actual, expected) + assertAnyIsNotIdenticalToExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values are identical.' diff --git a/test/unit/assertions/forAny/assertActualIsNotNullTests.ts b/test/unit/assertions/forAny/assertActualIsNotNullTests.ts index 482f19c..3a6f6f0 100644 --- a/test/unit/assertions/forAny/assertActualIsNotNullTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotNullTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotNull } from '../../../../lib/assertions/forAny/assertActualIsNotNull'; +import { assertAnyIsNotNull } from '../../../../lib/assertions/forAny/assertAnyIsNotNull'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -8,7 +8,7 @@ suite('assertActualIsNotNull', (): void => { const actual = 15; assert.that( - assertActualIsNotNull(actual) + assertAnyIsNotNull(actual) ).is.equalTo( value() ); @@ -18,7 +18,7 @@ suite('assertActualIsNotNull', (): void => { const actual = null; assert.that( - assertActualIsNotNull(actual) + assertAnyIsNotNull(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is null.' diff --git a/test/unit/assertions/forAny/assertActualIsNotOfTypeTests.ts b/test/unit/assertions/forAny/assertActualIsNotOfTypeTests.ts index 96a3f91..0243fe3 100644 --- a/test/unit/assertions/forAny/assertActualIsNotOfTypeTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotOfTypeTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotOfType } from '../../../../lib/assertions/forAny/assertActualIsNotOfType'; +import { assertAnyIsNotOfType } from '../../../../lib/assertions/forAny/assertAnyIsNotOfType'; import { AssertionFailed } from '../../../../lib/errors'; import { error } from 'defekt'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; @@ -11,7 +11,7 @@ suite('assertActualIsNotOfType', (): void => { const type = 'string'; assert.that( - assertActualIsNotOfType(actual, type as Type | 'result') + assertAnyIsNotOfType(actual, type as Type | 'result') ).is.aValue(); }); @@ -32,7 +32,7 @@ suite('assertActualIsNotOfType', (): void => { ]) { test('returns an error when asserting for a matching type.', async (): Promise => { assert.that( - assertActualIsNotOfType(value, type as Type | 'result') + assertAnyIsNotOfType(value, type as Type | 'result') ).is.equalTo(error(new AssertionFailed({ message: `The value is of type ${type}.`, actual: prettyPrint(value) diff --git a/test/unit/assertions/forAny/assertActualIsNotSameJsonAsExpectedTests.ts b/test/unit/assertions/forAny/assertActualIsNotSameJsonAsExpectedTests.ts index 647065a..37eb072 100644 --- a/test/unit/assertions/forAny/assertActualIsNotSameJsonAsExpectedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotSameJsonAsExpectedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotSameJsonAsExpected } from '../../../../lib/assertions/forAny/assertActualIsNotSameJsonAsExpected'; +import { assertAnyIsNotSameJsonAsExpected } from '../../../../lib/assertions/forAny/assertAnyIsNotSameJsonAsExpected'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -19,7 +19,7 @@ suite('assertActualIsNotSameJsonAsExpected', (): void => { }; assert.that( - assertActualIsNotSameJsonAsExpected(actual, expected) + assertAnyIsNotSameJsonAsExpected(actual, expected) ).is.equalTo( value() ); @@ -40,7 +40,7 @@ suite('assertActualIsNotSameJsonAsExpected', (): void => { }; assert.that( - assertActualIsNotSameJsonAsExpected(actual, expected) + assertAnyIsNotSameJsonAsExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values have the same JSON representation.', diff --git a/test/unit/assertions/forAny/assertActualIsNotTrueTests.ts b/test/unit/assertions/forAny/assertActualIsNotTrueTests.ts index 85d7739..5562152 100644 --- a/test/unit/assertions/forAny/assertActualIsNotTrueTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotTrueTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib/assertthat'; -import { assertActualIsNotTrue } from '../../../../lib/assertions/forAny/assertActualIsNotTrue'; +import { assertAnyIsNotTrue } from '../../../../lib/assertions/forAny/assertAnyIsNotTrue'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -7,14 +7,20 @@ suite('assertActualIsNotTrue', (): void => { test('does not return an error if actual is not true.', async (): Promise => { const actual = false; - assert.that(assertActualIsNotTrue(actual)).is.equalTo(value()); + assert.that(assertAnyIsNotTrue(actual)).is.equalTo(value()); }); test('returns an error if actual is true.', async (): Promise => { const actual = true; - assert.that(assertActualIsNotTrue(actual)).is.equalTo(error(new AssertionFailed({ + assert.that(assertAnyIsNotTrue(actual)).is.equalTo(error(new AssertionFailed({ message: 'The value is true.' }))); }); + + test('does not return an error if actual is something other than false.', async (): Promise => { + const actual = 'foo'; + + assert.that(assertAnyIsNotTrue(actual)).is.equalTo(value()); + }); }); diff --git a/test/unit/assertions/forAny/assertActualIsNotTruthyTests.ts b/test/unit/assertions/forAny/assertActualIsNotTruthyTests.ts index 2ea7f8a..2d49100 100644 --- a/test/unit/assertions/forAny/assertActualIsNotTruthyTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotTruthyTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotTruthy } from '../../../../lib/assertions/forAny/assertActualIsNotTruthy'; +import { assertAnyIsNotTruthy } from '../../../../lib/assertions/forAny/assertAnyIsNotTruthy'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsNotTruthy', (): void => { const actual = 0; assert.that( - assertActualIsNotTruthy(actual) + assertAnyIsNotTruthy(actual) ).is.equalTo( value() ); @@ -19,7 +19,7 @@ suite('assertActualIsNotTruthy', (): void => { const actual = 15; assert.that( - assertActualIsNotTruthy(actual) + assertAnyIsNotTruthy(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is truthy.', diff --git a/test/unit/assertions/forAny/assertActualIsNotUndefinedTests.ts b/test/unit/assertions/forAny/assertActualIsNotUndefinedTests.ts index 2a66ae4..67b6ef8 100644 --- a/test/unit/assertions/forAny/assertActualIsNotUndefinedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNotUndefinedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNotUndefined } from '../../../../lib/assertions/forAny/assertActualIsNotUndefined'; +import { assertAnyIsNotUndefined } from '../../../../lib/assertions/forAny/assertAnyIsNotUndefined'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -8,7 +8,7 @@ suite('assertActualIsNotUndefined', (): void => { const actual = 15; assert.that( - assertActualIsNotUndefined(actual) + assertAnyIsNotUndefined(actual) ).is.equalTo( value() ); @@ -18,7 +18,7 @@ suite('assertActualIsNotUndefined', (): void => { const actual = undefined; assert.that( - assertActualIsNotUndefined(actual) + assertAnyIsNotUndefined(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is undefined.' diff --git a/test/unit/assertions/forAny/assertActualIsNullTests.ts b/test/unit/assertions/forAny/assertActualIsNullTests.ts index 99f0333..321e028 100644 --- a/test/unit/assertions/forAny/assertActualIsNullTests.ts +++ b/test/unit/assertions/forAny/assertActualIsNullTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsNull } from '../../../../lib/assertions/forAny/assertActualIsNull'; +import { assertAnyIsNull } from '../../../../lib/assertions/forAny/assertAnyIsNull'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsNull', (): void => { const actual = null; assert.that( - assertActualIsNull(actual) + assertAnyIsNull(actual) ).is.equalTo( value() ); @@ -19,7 +19,7 @@ suite('assertActualIsNull', (): void => { const actual = 15; assert.that( - assertActualIsNull(actual) + assertAnyIsNull(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is not null.', diff --git a/test/unit/assertions/forAny/assertActualIsOfTypeTests.ts b/test/unit/assertions/forAny/assertActualIsOfTypeTests.ts index 7f9d65a..9766df4 100644 --- a/test/unit/assertions/forAny/assertActualIsOfTypeTests.ts +++ b/test/unit/assertions/forAny/assertActualIsOfTypeTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsOfType } from '../../../../lib/assertions/forAny/assertActualIsOfType'; +import { assertAnyIsOfType } from '../../../../lib/assertions/forAny/assertAnyIsOfType'; import { AssertionFailed } from '../../../../lib/errors'; import { error } from 'defekt'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; @@ -23,7 +23,7 @@ suite('assertActualIsOfType', (): void => { ]) { test('does not return an error when asserting for the correct type.', async (): Promise => { assert.that( - assertActualIsOfType(value, type as Type | 'result') + assertAnyIsOfType(value, type as Type | 'result') ).is.aValue(); }); } @@ -33,7 +33,7 @@ suite('assertActualIsOfType', (): void => { const type = 'string'; assert.that( - assertActualIsOfType(actual, type as Type | 'result') + assertAnyIsOfType(actual, type as Type | 'result') ).is.equalTo(error(new AssertionFailed({ message: 'The value is not of type string.', actual: prettyPrint(actual) diff --git a/test/unit/assertions/forAny/assertActualIsSameJsonAsExpectedTests.ts b/test/unit/assertions/forAny/assertActualIsSameJsonAsExpectedTests.ts index 81faf75..cb665f1 100644 --- a/test/unit/assertions/forAny/assertActualIsSameJsonAsExpectedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsSameJsonAsExpectedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsSameJsonAsExpected } from '../../../../lib/assertions/forAny/assertActualIsSameJsonAsExpected'; +import { assertAnyIsSameJsonAsExpected } from '../../../../lib/assertions/forAny/assertAnyIsSameJsonAsExpected'; import { AssertionFailed } from '../../../../lib/errors'; import { compare } from '../../../../lib/comparisons/typeAware/compare'; import { prettyPrintDiff } from '../../../../lib/prettyPrint/typeAware/prettyPrintDiff'; @@ -21,7 +21,7 @@ suite('assertActualIsSameJsonAsExpected', (): void => { }; assert.that( - assertActualIsSameJsonAsExpected(actual, expected) + assertAnyIsSameJsonAsExpected(actual, expected) ).is.equalTo( value() ); @@ -42,7 +42,7 @@ suite('assertActualIsSameJsonAsExpected', (): void => { }; assert.that( - assertActualIsSameJsonAsExpected(actual, expected) + assertAnyIsSameJsonAsExpected(actual, expected) ).is.equalTo( error(new AssertionFailed({ message: 'The values do not have the same JSON representation.', diff --git a/test/unit/assertions/forAny/assertActualIsTrueTests.ts b/test/unit/assertions/forAny/assertActualIsTrueTests.ts index 526d40a..51b42c6 100644 --- a/test/unit/assertions/forAny/assertActualIsTrueTests.ts +++ b/test/unit/assertions/forAny/assertActualIsTrueTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib/assertthat'; -import { assertActualIsTrue } from '../../../../lib/assertions/forAny/assertActualIsTrue'; +import { assertAnyIsTrue } from '../../../../lib/assertions/forAny/assertAnyIsTrue'; import { AssertionFailed } from '../../../../lib/errors'; import { error, value } from 'defekt'; @@ -7,13 +7,13 @@ suite('assertActualIsTrue', (): void => { test('does not return an error if actual is true.', async (): Promise => { const actual = true; - assert.that(assertActualIsTrue(actual)).is.equalTo(value()); + assert.that(assertAnyIsTrue(actual)).is.equalTo(value()); }); test('returns an error if actual is not true.', async (): Promise => { const actual = false; - assert.that(assertActualIsTrue(actual)).is.equalTo(error(new AssertionFailed({ + assert.that(assertAnyIsTrue(actual)).is.equalTo(error(new AssertionFailed({ message: 'The value is not true.' }))); }); diff --git a/test/unit/assertions/forAny/assertActualIsTruthyTests.ts b/test/unit/assertions/forAny/assertActualIsTruthyTests.ts index abb78f4..5a65873 100644 --- a/test/unit/assertions/forAny/assertActualIsTruthyTests.ts +++ b/test/unit/assertions/forAny/assertActualIsTruthyTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsTruthy } from '../../../../lib/assertions/forAny/assertActualIsTruthy'; +import { assertAnyIsTruthy } from '../../../../lib/assertions/forAny/assertAnyIsTruthy'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsTruthy', (): void => { const actual = 15; assert.that( - assertActualIsTruthy(actual) + assertAnyIsTruthy(actual) ).is.equalTo( value() ); @@ -19,7 +19,7 @@ suite('assertActualIsTruthy', (): void => { const actual = 0; assert.that( - assertActualIsTruthy(actual) + assertAnyIsTruthy(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is not truthy.', diff --git a/test/unit/assertions/forAny/assertActualIsUndefinedTests.ts b/test/unit/assertions/forAny/assertActualIsUndefinedTests.ts index 14209c9..2c8bf26 100644 --- a/test/unit/assertions/forAny/assertActualIsUndefinedTests.ts +++ b/test/unit/assertions/forAny/assertActualIsUndefinedTests.ts @@ -1,5 +1,5 @@ import { assert } from '../../../../lib'; -import { assertActualIsUndefined } from '../../../../lib/assertions/forAny/assertActualIsUndefined'; +import { assertAnyIsUndefined } from '../../../../lib/assertions/forAny/assertAnyIsUndefined'; import { AssertionFailed } from '../../../../lib/errors'; import { prettyPrint } from '../../../../lib/prettyPrint/typeAware/prettyPrint'; import { error, value } from 'defekt'; @@ -9,7 +9,7 @@ suite('assertActualIsUndefined', (): void => { const actual = undefined; assert.that( - assertActualIsUndefined(actual) + assertAnyIsUndefined(actual) ).is.equalTo( value() ); @@ -19,7 +19,7 @@ suite('assertActualIsUndefined', (): void => { const actual = 15; assert.that( - assertActualIsUndefined(actual) + assertAnyIsUndefined(actual) ).is.equalTo( error(new AssertionFailed({ message: 'The value is not undefined.', diff --git a/test/unit/dispel/dispelErrorTests.ts b/test/unit/dispel/dispelErrorTests.ts index 8ff0505..a7ea4fb 100644 --- a/test/unit/dispel/dispelErrorTests.ts +++ b/test/unit/dispel/dispelErrorTests.ts @@ -27,6 +27,7 @@ suite('dispelError', (): void => { assert.that(dispelledError).is.instanceOf(CustomError); assert.that(dispelledError).is.equalTo({ message: 'Message.', + name: 'Error', foo: 'Foo.', bar: 'Bar.', recursion: [ recursion({ recursionPath: '/' }) ] diff --git a/test/unit/wrapAssertionForIterableTests.ts b/test/unit/wrapAssertionForIterableTests.ts new file mode 100644 index 0000000..13a8792 --- /dev/null +++ b/test/unit/wrapAssertionForIterableTests.ts @@ -0,0 +1,112 @@ +import { assert } from '../../lib'; +import { assertAnyIsEqualToExpected } from '../../lib/assertions/forAny/assertAnyIsEqualToExpected'; +import { assertFunctionIsThrowingAsync } from '../../lib/assertions/forFunctions/assertFunctionIsThrowingAsync'; +import { wrapAssertionForIterable, wrapAsyncAssertionForIterable } from '../../lib/wrapAssertionForIterable'; + +suite('wrapAssertionForIterable', (): void => { + test('it augments the error message to point to the relevant item of the array.', async (): Promise => { + const aValue = [ 'foo', 'foo', 'bar', 'foo' ]; + + const assertEachIsEqualTo = wrapAssertionForIterable(assertAnyIsEqualToExpected); + + const result = assertEachIsEqualTo(aValue, 'foo'); + + if (result.hasError()) { + assert.that(result.error.message).is.startingWith('Assertion failed for item 2 of the array.\n'); + } else { + throw new Error('heck this should have been an error'); + } + }); + + test('it augments the error message to point to the relevant item of the set.', async (): Promise => { + const aValue = new Set([ 'foo', 'bar' ]); + + const assertEachIsEqualTo = wrapAssertionForIterable(assertAnyIsEqualToExpected); + + const result = assertEachIsEqualTo(aValue, 'foo'); + + if (result.hasError()) { + assert.that(result.error.message).is.startingWith('Assertion failed for item "bar" of the set.\n'); + } else { + throw new Error('heck this should have been an error'); + } + }); + + test('it augments the error message to point to the relevant item of the map.', async (): Promise => { + const aValue = new Map(); + + aValue.set('foo', 'foo'); + aValue.set('bar', 'bar'); + + const assertEachIsEqualTo = wrapAssertionForIterable(assertAnyIsEqualToExpected); + + const result = assertEachIsEqualTo(aValue, 'foo'); + + if (result.hasError()) { + assert.that(result.error.message).is.startingWith('Assertion failed for item "bar" of the map.\n'); + } else { + throw new Error('heck this should have been an error'); + } + }); + + suite('wrapAsyncAssertionForIterable', (): void => { + test('it augments the error message to point to the relevant item of the array.', async (): Promise => { + const aValue = [ + async (): Promise => { + throw new Error('Foo.'); + }, + async (): Promise => 5 + ]; + + const assertEachIsThrowingAsync = wrapAsyncAssertionForIterable(assertFunctionIsThrowingAsync); + + const result = await assertEachIsThrowingAsync(aValue); + + if (result.hasError()) { + assert.that(result.error.message).is.startingWith('Assertion failed for item 1 of the array.\n'); + } else { + throw new Error('heck this should have been an error'); + } + }); + + test('it augments the error message to point to the relevant item of the set.', async (): Promise => { + const aValue = new Set([ + async (): Promise => { + throw new Error('Foo.'); + }, + async (): Promise => 5 + ]); + + const assertEachIsThrowingAsync = wrapAsyncAssertionForIterable(assertFunctionIsThrowingAsync); + + const result = await assertEachIsThrowingAsync(aValue); + + if (result.hasError()) { + assert.that(result.error.message).is.startingWith('Assertion failed for item function (...) { ... } of the set.\n'); + } else { + throw new Error('heck this should have been an error'); + } + }); + + test('it augments the error message to point to the relevant item of the map.', async (): Promise => { + // This seems to be a false positive. + // eslint-disable-next-line @typescript-eslint/no-extra-parens + const aValue = new Map any>([ + [ 'foo', async (): Promise => { + throw new Error('Foo.'); + } ], + [ 'bar', async (): Promise => 5 ] + ]); + + const assertEachIsThrowingAsync = wrapAsyncAssertionForIterable(assertFunctionIsThrowingAsync); + + const result = await assertEachIsThrowingAsync(aValue); + + if (result.hasError()) { + assert.that(result.error.message).is.startingWith('Assertion failed for item "bar" of the map.\n'); + } else { + throw new Error('heck this should have been an error'); + } + }); + }); +});