@overkill-dev/engine 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/assertion-protocol/assertion-evaluation.d.ts +13 -0
- package/assertion-protocol/assertion-evaluation.d.ts.map +1 -0
- package/assertion-protocol/assertion-evaluation.js +6 -0
- package/assertion-protocol/assertion-evaluation.js.map +1 -0
- package/assertion-protocol/assertion-node-shape.d.ts +71 -0
- package/assertion-protocol/assertion-node-shape.d.ts.map +1 -0
- package/assertion-protocol/assertion-node.d.ts +97 -0
- package/assertion-protocol/assertion-node.d.ts.map +1 -0
- package/assertion-protocol/assertion-node.js +33 -0
- package/assertion-protocol/assertion-node.js.map +1 -0
- package/assertion-protocol/assertion-reference.d.ts +73 -0
- package/assertion-protocol/assertion-reference.d.ts.map +1 -0
- package/assertion-protocol/assertion-reference.js +49 -0
- package/assertion-protocol/assertion-reference.js.map +1 -0
- package/assertion-protocol/assertions/boolean.d.ts +11 -0
- package/assertion-protocol/assertions/boolean.d.ts.map +1 -0
- package/assertion-protocol/assertions/boolean.js +12 -0
- package/assertion-protocol/assertions/boolean.js.map +1 -0
- package/assertion-protocol/assertions/collection.d.ts +22 -0
- package/assertion-protocol/assertions/collection.d.ts.map +1 -0
- package/assertion-protocol/assertions/collection.js +21 -0
- package/assertion-protocol/assertions/collection.js.map +1 -0
- package/assertion-protocol/assertions/dispatch.d.ts +88 -0
- package/assertion-protocol/assertions/dispatch.d.ts.map +1 -0
- package/assertion-protocol/assertions/dispatch.js +47 -0
- package/assertion-protocol/assertions/dispatch.js.map +1 -0
- package/assertion-protocol/assertions/equality.d.ts +17 -0
- package/assertion-protocol/assertions/equality.d.ts.map +1 -0
- package/assertion-protocol/assertions/equality.js +24 -0
- package/assertion-protocol/assertions/equality.js.map +1 -0
- package/assertion-protocol/assertions/fail.d.ts +13 -0
- package/assertion-protocol/assertions/fail.d.ts.map +1 -0
- package/assertion-protocol/assertions/fail.js +8 -0
- package/assertion-protocol/assertions/fail.js.map +1 -0
- package/assertion-protocol/assertions/numeric.d.ts +29 -0
- package/assertion-protocol/assertions/numeric.d.ts.map +1 -0
- package/assertion-protocol/assertions/numeric.js +43 -0
- package/assertion-protocol/assertions/numeric.js.map +1 -0
- package/assertion-protocol/assertions/partial.d.ts +14 -0
- package/assertion-protocol/assertions/partial.d.ts.map +1 -0
- package/assertion-protocol/assertions/partial.js +17 -0
- package/assertion-protocol/assertions/partial.js.map +1 -0
- package/assertion-protocol/assertions/presence.d.ts +17 -0
- package/assertion-protocol/assertions/presence.d.ts.map +1 -0
- package/assertion-protocol/assertions/presence.js +20 -0
- package/assertion-protocol/assertions/presence.js.map +1 -0
- package/assertion-protocol/assertions/string.d.ts +28 -0
- package/assertion-protocol/assertions/string.d.ts.map +1 -0
- package/assertion-protocol/assertions/string.js +33 -0
- package/assertion-protocol/assertions/string.js.map +1 -0
- package/assertion-protocol/assertions/type-shape.d.ts +42 -0
- package/assertion-protocol/assertions/type-shape.d.ts.map +1 -0
- package/assertion-protocol/assertions/type-shape.js +43 -0
- package/assertion-protocol/assertions/type-shape.js.map +1 -0
- package/assertion-protocol/collection-count.d.ts +6 -0
- package/assertion-protocol/collection-count.d.ts.map +1 -0
- package/assertion-protocol/collection-count.js +42 -0
- package/assertion-protocol/collection-count.js.map +1 -0
- package/assertion-protocol/evaluation.d.ts +32 -0
- package/assertion-protocol/evaluation.d.ts.map +1 -0
- package/assertion-protocol/evaluation.js +170 -0
- package/assertion-protocol/evaluation.js.map +1 -0
- package/assertion-protocol/partial-matching.d.ts +4 -0
- package/assertion-protocol/partial-matching.d.ts.map +1 -0
- package/assertion-protocol/partial-matching.js +13 -0
- package/assertion-protocol/partial-matching.js.map +1 -0
- package/assertion-protocol/source-location.d.ts +6 -0
- package/assertion-protocol/source-location.d.ts.map +1 -0
- package/assertion-protocol/source-location.js +76 -0
- package/assertion-protocol/source-location.js.map +1 -0
- package/assertion-protocol/thrown-error-record.d.ts +8 -0
- package/assertion-protocol/thrown-error-record.d.ts.map +1 -0
- package/assertion-protocol/thrown-error-record.js +17 -0
- package/assertion-protocol/thrown-error-record.js.map +1 -0
- package/assertion-protocol/thrown-matcher.d.ts +51 -0
- package/assertion-protocol/thrown-matcher.d.ts.map +1 -0
- package/assertion-protocol/thrown-matcher.js +201 -0
- package/assertion-protocol/thrown-matcher.js.map +1 -0
- package/compare/comparison-result.d.ts +25 -0
- package/compare/comparison-result.d.ts.map +1 -0
- package/compare/comparison-result.js +47 -0
- package/compare/comparison-result.js.map +1 -0
- package/compare/comparison-state.d.ts +7 -0
- package/compare/comparison-state.d.ts.map +1 -0
- package/compare/comparison-state.js +20 -0
- package/compare/comparison-state.js.map +1 -0
- package/compare/comparison.d.ts +12 -0
- package/compare/comparison.d.ts.map +1 -0
- package/compare/comparison.js +78 -0
- package/compare/comparison.js.map +1 -0
- package/compare/diff-path.d.ts +8 -0
- package/compare/diff-path.d.ts.map +1 -0
- package/compare/diff-path.js +37 -0
- package/compare/diff-path.js.map +1 -0
- package/compare/raw-comparison.d.ts +24 -0
- package/compare/raw-comparison.d.ts.map +1 -0
- package/compare/raw-comparison.js +285 -0
- package/compare/raw-comparison.js.map +1 -0
- package/compare/serialized-value-classification.d.ts +12 -0
- package/compare/serialized-value-classification.d.ts.map +1 -0
- package/compare/serialized-value-classification.js +99 -0
- package/compare/serialized-value-classification.js.map +1 -0
- package/compare/serialized-value-shape.d.ts +143 -0
- package/compare/serialized-value-shape.d.ts.map +1 -0
- package/compare/serialized-value-shape.js +12 -0
- package/compare/serialized-value-shape.js.map +1 -0
- package/compare/serialized-value-state.d.ts +12 -0
- package/compare/serialized-value-state.d.ts.map +1 -0
- package/compare/serialized-value-state.js +55 -0
- package/compare/serialized-value-state.js.map +1 -0
- package/compare/serialized-value.d.ts +11 -0
- package/compare/serialized-value.d.ts.map +1 -0
- package/compare/serialized-value.js +389 -0
- package/compare/serialized-value.js.map +1 -0
- package/compare/structured-diff.d.ts +4 -0
- package/compare/structured-diff.d.ts.map +1 -0
- package/compare/structured-diff.js +382 -0
- package/compare/structured-diff.js.map +1 -0
- package/compare/value-classification.d.ts +26 -0
- package/compare/value-classification.d.ts.map +1 -0
- package/compare/value-classification.js +112 -0
- package/compare/value-classification.js.map +1 -0
- package/diff/binary-diff.d.ts +4 -0
- package/diff/binary-diff.d.ts.map +1 -0
- package/diff/binary-diff.js +49 -0
- package/diff/binary-diff.js.map +1 -0
- package/diff/diff-shape.d.ts +117 -0
- package/diff/diff-shape.d.ts.map +1 -0
- package/diff/string-diff.d.ts +3 -0
- package/diff/string-diff.d.ts.map +1 -0
- package/diff/string-diff.js +22 -0
- package/diff/string-diff.js.map +1 -0
- package/engine/assertion-facade.d.ts +50 -0
- package/engine/assertion-facade.d.ts.map +1 -0
- package/engine/assertion-facade.js +361 -0
- package/engine/assertion-facade.js.map +1 -0
- package/engine/case-execution.d.ts +10 -0
- package/engine/case-execution.d.ts.map +1 -0
- package/engine/case-execution.js +408 -0
- package/engine/case-execution.js.map +1 -0
- package/engine/custom-assertion-recording.d.ts +33 -0
- package/engine/custom-assertion-recording.d.ts.map +1 -0
- package/engine/custom-assertion-recording.js +175 -0
- package/engine/custom-assertion-recording.js.map +1 -0
- package/engine/engine.d.ts +24 -0
- package/engine/engine.d.ts.map +1 -0
- package/engine/engine.js +33 -0
- package/engine/engine.js.map +1 -0
- package/engine/execution.d.ts +16 -0
- package/engine/execution.d.ts.map +1 -0
- package/engine/execution.js +223 -0
- package/engine/execution.js.map +1 -0
- package/engine/identity.d.ts +12 -0
- package/engine/identity.d.ts.map +1 -0
- package/engine/identity.js +20 -0
- package/engine/identity.js.map +1 -0
- package/engine/reporter.d.ts +103 -0
- package/engine/reporter.d.ts.map +1 -0
- package/engine/reporter.js +177 -0
- package/engine/reporter.js.map +1 -0
- package/engine/require-assertion-facade.d.ts +21 -0
- package/engine/require-assertion-facade.d.ts.map +1 -0
- package/engine/require-assertion-facade.js +127 -0
- package/engine/require-assertion-facade.js.map +1 -0
- package/engine/run-if-main.d.ts +20 -0
- package/engine/run-if-main.d.ts.map +1 -0
- package/engine/run-if-main.js +30 -0
- package/engine/run-if-main.js.map +1 -0
- package/engine/run-result.d.ts +110 -0
- package/engine/run-result.d.ts.map +1 -0
- package/engine/run-result.js +13 -0
- package/engine/run-result.js.map +1 -0
- package/engine/test-node.d.ts +88 -0
- package/engine/test-node.d.ts.map +1 -0
- package/engine/test-node.js +103 -0
- package/engine/test-node.js.map +1 -0
- package/engine/test-plan.d.ts +20 -0
- package/engine/test-plan.d.ts.map +1 -0
- package/engine/test-plan.js +115 -0
- package/engine/test-plan.js.map +1 -0
- package/package.json +78 -6
- package/packages/engine/assertion-protocol.entry-point.d.ts +9 -0
- package/packages/engine/assertion-protocol.entry-point.d.ts.map +1 -0
- package/packages/engine/assertion-protocol.entry-point.js +4 -0
- package/packages/engine/assertion-protocol.entry-point.js.map +1 -0
- package/packages/engine/engine.entry-point.d.ts +39 -0
- package/packages/engine/engine.entry-point.d.ts.map +1 -0
- package/packages/engine/engine.entry-point.js +47 -0
- package/packages/engine/engine.entry-point.js.map +1 -0
- package/readme.md +121 -5
- package/sbom.cdx.json +67 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { evaluateFalse, evaluateTrue } from "./boolean.js";
|
|
2
|
+
import { evaluateEmpty, evaluateLength, evaluateNotEmpty } from "./collection.js";
|
|
3
|
+
import { evaluateDeepEqual, evaluateEqual, evaluateNotDeepEqual, evaluateNotEqual } from "./equality.js";
|
|
4
|
+
import { evaluateFail } from "./fail.js";
|
|
5
|
+
import { evaluateBetween, evaluateGreaterThan, evaluateGreaterThanOrEqual, evaluateLessThan, evaluateLessThanOrEqual } from "./numeric.js";
|
|
6
|
+
import { evaluateArrayContainsPartial, evaluateMembersPartialDeepEqual, evaluatePartialDeepEqual } from "./partial.js";
|
|
7
|
+
import { evaluateDefined, evaluateNotNull, evaluateNull, evaluateUndefined } from "./presence.js";
|
|
8
|
+
import { evaluateEndsWith, evaluateIncludes, evaluateMatch, evaluateNotMatch, evaluateStartsWith } from "./string.js";
|
|
9
|
+
import { evaluateArray, evaluateBoolean, evaluateFunction, evaluateHasProperty, evaluateInstanceOf, evaluateNumber, evaluateObject, evaluateString } from "./type-shape.js";
|
|
10
|
+
export const assertionEvaluatorByCheck = {
|
|
11
|
+
array: evaluateArray,
|
|
12
|
+
'array-contains-partial': evaluateArrayContainsPartial,
|
|
13
|
+
between: evaluateBetween,
|
|
14
|
+
boolean: evaluateBoolean,
|
|
15
|
+
'deep-equal': evaluateDeepEqual,
|
|
16
|
+
defined: evaluateDefined,
|
|
17
|
+
empty: evaluateEmpty,
|
|
18
|
+
'ends-with': evaluateEndsWith,
|
|
19
|
+
equal: evaluateEqual,
|
|
20
|
+
fail: evaluateFail,
|
|
21
|
+
false: evaluateFalse,
|
|
22
|
+
function: evaluateFunction,
|
|
23
|
+
'greater-than': evaluateGreaterThan,
|
|
24
|
+
'greater-than-or-equal': evaluateGreaterThanOrEqual,
|
|
25
|
+
'has-property': evaluateHasProperty,
|
|
26
|
+
includes: evaluateIncludes,
|
|
27
|
+
'instance-of': evaluateInstanceOf,
|
|
28
|
+
length: evaluateLength,
|
|
29
|
+
'less-than': evaluateLessThan,
|
|
30
|
+
'less-than-or-equal': evaluateLessThanOrEqual,
|
|
31
|
+
match: evaluateMatch,
|
|
32
|
+
'members-partial-deep-equal': evaluateMembersPartialDeepEqual,
|
|
33
|
+
'not-deep-equal': evaluateNotDeepEqual,
|
|
34
|
+
'not-empty': evaluateNotEmpty,
|
|
35
|
+
'not-equal': evaluateNotEqual,
|
|
36
|
+
'not-match': evaluateNotMatch,
|
|
37
|
+
'not-null': evaluateNotNull,
|
|
38
|
+
null: evaluateNull,
|
|
39
|
+
number: evaluateNumber,
|
|
40
|
+
object: evaluateObject,
|
|
41
|
+
'partial-deep-equal': evaluatePartialDeepEqual,
|
|
42
|
+
'starts-with': evaluateStartsWith,
|
|
43
|
+
string: evaluateString,
|
|
44
|
+
true: evaluateTrue,
|
|
45
|
+
undefined: evaluateUndefined
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAmD,MAAM,cAAc,CAAC;AAC5G,OAAO,EACH,aAAa,EACb,cAAc,EACd,gBAAgB,EAGnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAKnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAA0B,MAAM,WAAW,CAAC;AACjE,OAAO,EACH,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAChB,uBAAuB,EAG1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,4BAA4B,EAC5B,+BAA+B,EAC/B,wBAAwB,EAI3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,eAAe,EACf,eAAe,EACf,YAAY,EACZ,iBAAiB,EAKpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAGrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EAIjB,MAAM,iBAAiB,CAAC;AAiDzB,MAAM,CAAC,MAAM,yBAAyB,GAA8B;IAChE,KAAK,EAAE,aAAa;IACpB,wBAAwB,EAAE,4BAA4B;IACtD,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,iBAAiB;IAC/B,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,gBAAgB;IAC7B,KAAK,EAAE,aAAa;IACpB,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,gBAAgB;IAC1B,cAAc,EAAE,mBAAmB;IACnC,uBAAuB,EAAE,0BAA0B;IACnD,cAAc,EAAE,mBAAmB;IACnC,QAAQ,EAAE,gBAAgB;IAC1B,aAAa,EAAE,kBAAkB;IACjC,MAAM,EAAE,cAAc;IACtB,WAAW,EAAE,gBAAgB;IAC7B,oBAAoB,EAAE,uBAAuB;IAC7C,KAAK,EAAE,aAAa;IACpB,4BAA4B,EAAE,+BAA+B;IAC7D,gBAAgB,EAAE,oBAAoB;IACtC,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,eAAe;IAC3B,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,cAAc;IACtB,oBAAoB,EAAE,wBAAwB;IAC9C,aAAa,EAAE,kBAAkB;IACjC,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,YAAY;IAClB,SAAS,EAAE,iBAAiB;CAC/B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { AssertionSource, ExpectedAssertionNode } from '../assertion-node-shape.ts';
|
|
3
|
+
export type EqualAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'equal'>;
|
|
4
|
+
export type NotEqualAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'not-equal'>;
|
|
5
|
+
export type DeepEqualAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'deep-equal'>;
|
|
6
|
+
export type NotDeepEqualAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'not-deep-equal'>;
|
|
7
|
+
export declare const equalitySummaryByCheck: {
|
|
8
|
+
readonly 'deep-equal': "Expected values to be deeply equal.";
|
|
9
|
+
readonly equal: "Expected values to be equal.";
|
|
10
|
+
readonly 'not-deep-equal': "Expected values not to be deeply equal.";
|
|
11
|
+
readonly 'not-equal': "Expected values not to be equal.";
|
|
12
|
+
};
|
|
13
|
+
export declare function evaluateDeepEqual(assertion: DeepEqualAssertionNode): AssertionOutcome;
|
|
14
|
+
export declare function evaluateEqual(assertion: EqualAssertionNode): AssertionOutcome;
|
|
15
|
+
export declare function evaluateNotDeepEqual(assertion: NotDeepEqualAssertionNode): AssertionOutcome;
|
|
16
|
+
export declare function evaluateNotEqual(assertion: NotEqualAssertionNode): AssertionOutcome;
|
|
17
|
+
//# sourceMappingURL=equality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equality.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/equality.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuC,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACxG,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEzF,MAAM,MAAM,kBAAkB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,qBAAqB,CACpG,MAAM,EACN,OAAO,CACV,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,qBAAqB,CACvG,MAAM,EACN,WAAW,CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,qBAAqB,CACxG,MAAM,EACN,YAAY,CACf,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,qBAAqB,CAC3G,MAAM,EACN,gBAAgB,CACnB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,sBAAsB,GAAG,gBAAgB,CAErF;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,kBAAkB,GAAG,gBAAgB,CAM7E;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,yBAAyB,GAAG,gBAAgB,CAM3F;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,qBAAqB,GAAG,gBAAgB,CAEnF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { compareDeepValues, compareEqualValues, compareStringEquality } from "../../compare/comparison.js";
|
|
2
|
+
import { assertionOutcome, comparisonOutcome } from "../assertion-evaluation.js";
|
|
3
|
+
export const equalitySummaryByCheck = {
|
|
4
|
+
'deep-equal': 'Expected values to be deeply equal.',
|
|
5
|
+
equal: 'Expected values to be equal.',
|
|
6
|
+
'not-deep-equal': 'Expected values not to be deeply equal.',
|
|
7
|
+
'not-equal': 'Expected values not to be equal.'
|
|
8
|
+
};
|
|
9
|
+
export function evaluateDeepEqual(assertion) {
|
|
10
|
+
return comparisonOutcome(compareDeepValues(assertion.actual, assertion.expected));
|
|
11
|
+
}
|
|
12
|
+
export function evaluateEqual(assertion) {
|
|
13
|
+
if (typeof assertion.actual === 'string' && typeof assertion.expected === 'string') {
|
|
14
|
+
return comparisonOutcome(compareStringEquality(assertion.actual, assertion.expected));
|
|
15
|
+
}
|
|
16
|
+
return comparisonOutcome(compareEqualValues(assertion.actual, assertion.expected));
|
|
17
|
+
}
|
|
18
|
+
export function evaluateNotDeepEqual(assertion) {
|
|
19
|
+
return assertionOutcome(assertion.actual, assertion.expected, !compareDeepValues(assertion.actual, assertion.expected).passed);
|
|
20
|
+
}
|
|
21
|
+
export function evaluateNotEqual(assertion) {
|
|
22
|
+
return assertionOutcome(assertion.actual, assertion.expected, !Object.is(assertion.actual, assertion.expected));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=equality.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { AssertionSource, ResolvableSourceLocation } from '../assertion-node-shape.ts';
|
|
3
|
+
export type FailAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
4
|
+
readonly check: 'fail';
|
|
5
|
+
readonly location: ResolvableSourceLocation;
|
|
6
|
+
readonly message: string | null;
|
|
7
|
+
readonly source: Source;
|
|
8
|
+
};
|
|
9
|
+
export declare const failSummaryByCheck: {
|
|
10
|
+
readonly fail: "Assertion failed.";
|
|
11
|
+
};
|
|
12
|
+
export declare function evaluateFail(assertion: FailAssertionNode): AssertionOutcome;
|
|
13
|
+
//# sourceMappingURL=fail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fail.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/fail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;CAErB,CAAC;AAEX,wBAAgB,YAAY,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE3E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { assertionOutcome } from "../assertion-evaluation.js";
|
|
2
|
+
export const failSummaryByCheck = {
|
|
3
|
+
fail: 'Assertion failed.'
|
|
4
|
+
};
|
|
5
|
+
export function evaluateFail(assertion) {
|
|
6
|
+
return assertionOutcome(assertion.check, 'pass', false);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=fail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fail.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/fail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAUrF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,IAAI,EAAE,mBAAmB;CACnB,CAAC;AAEX,MAAM,UAAU,YAAY,CAAC,SAA4B;IACrD,OAAO,gBAAgB,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { AssertionSource, ExpectedAssertionNode, ResolvableSourceLocation } from '../assertion-node-shape.ts';
|
|
3
|
+
type NumericComparisonCheck = 'greater-than' | 'greater-than-or-equal' | 'less-than' | 'less-than-or-equal';
|
|
4
|
+
export type NumericComparisonAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
5
|
+
readonly [Check in NumericComparisonCheck]: ExpectedAssertionNode<Source, Check>;
|
|
6
|
+
}[NumericComparisonCheck];
|
|
7
|
+
export type BetweenAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
8
|
+
readonly actual: unknown;
|
|
9
|
+
readonly check: 'between';
|
|
10
|
+
readonly location: ResolvableSourceLocation;
|
|
11
|
+
readonly maximum: number;
|
|
12
|
+
readonly message: string | null;
|
|
13
|
+
readonly minimum: number;
|
|
14
|
+
readonly source: Source;
|
|
15
|
+
};
|
|
16
|
+
export declare const numericSummaryByCheck: {
|
|
17
|
+
readonly between: "Expected number to be between the bounds.";
|
|
18
|
+
readonly 'greater-than': "Expected number to be greater than the threshold.";
|
|
19
|
+
readonly 'greater-than-or-equal': "Expected number to be greater than or equal to the threshold.";
|
|
20
|
+
readonly 'less-than': "Expected number to be less than the threshold.";
|
|
21
|
+
readonly 'less-than-or-equal': "Expected number to be less than or equal to the threshold.";
|
|
22
|
+
};
|
|
23
|
+
export declare function evaluateBetween(assertion: BetweenAssertionNode): AssertionOutcome;
|
|
24
|
+
export declare function evaluateGreaterThan(assertion: NumericComparisonAssertionNode): AssertionOutcome;
|
|
25
|
+
export declare function evaluateGreaterThanOrEqual(assertion: NumericComparisonAssertionNode): AssertionOutcome;
|
|
26
|
+
export declare function evaluateLessThan(assertion: NumericComparisonAssertionNode): AssertionOutcome;
|
|
27
|
+
export declare function evaluateLessThanOrEqual(assertion: NumericComparisonAssertionNode): AssertionOutcome;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=numeric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/numeric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEnH,KAAK,sBAAsB,GAAG,cAAc,GAAG,uBAAuB,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAE5G,MAAM,MAAM,8BAA8B,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI;IAC3F,QAAQ,EAAE,KAAK,IAAI,sBAAsB,GAAG,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC;CACnF,CAAC,sBAAsB,CAAC,CAAC;AAE1B,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI;IACjF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;CAMxB,CAAC;AAMX,wBAAgB,eAAe,CAAC,SAAS,EAAE,oBAAoB,GAAG,gBAAgB,CAOjF;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,8BAA8B,GAAG,gBAAgB,CAM/F;AAED,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,8BAA8B,GAAG,gBAAgB,CAMtG;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,8BAA8B,GAAG,gBAAgB,CAM5F;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,8BAA8B,GAAG,gBAAgB,CAMnG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { assertionOutcome } from "../assertion-evaluation.js";
|
|
2
|
+
export const numericSummaryByCheck = {
|
|
3
|
+
between: 'Expected number to be between the bounds.',
|
|
4
|
+
'greater-than': 'Expected number to be greater than the threshold.',
|
|
5
|
+
'greater-than-or-equal': 'Expected number to be greater than or equal to the threshold.',
|
|
6
|
+
'less-than': 'Expected number to be less than the threshold.',
|
|
7
|
+
'less-than-or-equal': 'Expected number to be less than or equal to the threshold.'
|
|
8
|
+
};
|
|
9
|
+
function isFiniteNumber(value) {
|
|
10
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
11
|
+
}
|
|
12
|
+
export function evaluateBetween(assertion) {
|
|
13
|
+
const expected = `${assertion.minimum}..${assertion.maximum}`;
|
|
14
|
+
const passed = isFiniteNumber(assertion.actual) &&
|
|
15
|
+
assertion.actual >= assertion.minimum &&
|
|
16
|
+
assertion.actual <= assertion.maximum;
|
|
17
|
+
return assertionOutcome(assertion.actual, expected, passed);
|
|
18
|
+
}
|
|
19
|
+
export function evaluateGreaterThan(assertion) {
|
|
20
|
+
const passed = isFiniteNumber(assertion.actual) &&
|
|
21
|
+
isFiniteNumber(assertion.expected) &&
|
|
22
|
+
assertion.actual > assertion.expected;
|
|
23
|
+
return assertionOutcome(assertion.actual, `> ${assertion.expected}`, passed);
|
|
24
|
+
}
|
|
25
|
+
export function evaluateGreaterThanOrEqual(assertion) {
|
|
26
|
+
const passed = isFiniteNumber(assertion.actual) &&
|
|
27
|
+
isFiniteNumber(assertion.expected) &&
|
|
28
|
+
assertion.actual >= assertion.expected;
|
|
29
|
+
return assertionOutcome(assertion.actual, `>= ${assertion.expected}`, passed);
|
|
30
|
+
}
|
|
31
|
+
export function evaluateLessThan(assertion) {
|
|
32
|
+
const passed = isFiniteNumber(assertion.actual) &&
|
|
33
|
+
isFiniteNumber(assertion.expected) &&
|
|
34
|
+
assertion.actual < assertion.expected;
|
|
35
|
+
return assertionOutcome(assertion.actual, `< ${assertion.expected}`, passed);
|
|
36
|
+
}
|
|
37
|
+
export function evaluateLessThanOrEqual(assertion) {
|
|
38
|
+
const passed = isFiniteNumber(assertion.actual) &&
|
|
39
|
+
isFiniteNumber(assertion.expected) &&
|
|
40
|
+
assertion.actual <= assertion.expected;
|
|
41
|
+
return assertionOutcome(assertion.actual, `<= ${assertion.expected}`, passed);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=numeric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numeric.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/numeric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAmBrF,MAAM,CAA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AAS,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAyC;IACtE,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC;QAC3C,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC;QAClC,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;IAE1C,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,SAAS,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,SAAyC;IAC7E,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC;QAC3C,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC;QAClC,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC;IAE3C,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,SAAS,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { AssertionSource, ExpectedAssertionNode } from '../assertion-node-shape.ts';
|
|
3
|
+
export type PartialDeepEqualAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'partial-deep-equal'>;
|
|
4
|
+
export type ArrayContainsPartialAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'array-contains-partial'>;
|
|
5
|
+
export type MembersPartialDeepEqualAssertionNode<Source extends AssertionSource = AssertionSource> = ExpectedAssertionNode<Source, 'members-partial-deep-equal'>;
|
|
6
|
+
export declare const partialSummaryByCheck: {
|
|
7
|
+
readonly 'array-contains-partial': "Expected array to contain a partial member.";
|
|
8
|
+
readonly 'members-partial-deep-equal': "Expected array to contain the partial members.";
|
|
9
|
+
readonly 'partial-deep-equal': "Expected value to partially match.";
|
|
10
|
+
};
|
|
11
|
+
export declare function evaluateArrayContainsPartial(assertion: ArrayContainsPartialAssertionNode): AssertionOutcome;
|
|
12
|
+
export declare function evaluateMembersPartialDeepEqual(assertion: MembersPartialDeepEqualAssertionNode): AssertionOutcome;
|
|
13
|
+
export declare function evaluatePartialDeepEqual(assertion: PartialDeepEqualAssertionNode): AssertionOutcome;
|
|
14
|
+
//# sourceMappingURL=partial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/partial.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEzF,MAAM,MAAM,6BAA6B,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,qBAAqB,CAC/G,MAAM,EACN,oBAAoB,CACvB,CAAC;AAEF,MAAM,MAAM,iCAAiC,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,qBAAqB,CACnH,MAAM,EACN,wBAAwB,CAC3B,CAAC;AAEF,MAAM,MAAM,oCAAoC,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAC7F,qBAAqB,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;AAEhE,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AAEX,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,iCAAiC,GAAG,gBAAgB,CAE3G;AAED,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,oCAAoC,GAAG,gBAAgB,CAEjH;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,6BAA6B,GAAG,gBAAgB,CAEnG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { compareArrayContainsPartial, compareMembersPartialDeepEqual, comparePartialValue } from "../../compare/comparison.js";
|
|
2
|
+
import { comparisonOutcome } from "../assertion-evaluation.js";
|
|
3
|
+
export const partialSummaryByCheck = {
|
|
4
|
+
'array-contains-partial': 'Expected array to contain a partial member.',
|
|
5
|
+
'members-partial-deep-equal': 'Expected array to contain the partial members.',
|
|
6
|
+
'partial-deep-equal': 'Expected value to partially match.'
|
|
7
|
+
};
|
|
8
|
+
export function evaluateArrayContainsPartial(assertion) {
|
|
9
|
+
return comparisonOutcome(compareArrayContainsPartial(assertion.actual, assertion.expected));
|
|
10
|
+
}
|
|
11
|
+
export function evaluateMembersPartialDeepEqual(assertion) {
|
|
12
|
+
return comparisonOutcome(compareMembersPartialDeepEqual(assertion.actual, assertion.expected));
|
|
13
|
+
}
|
|
14
|
+
export function evaluatePartialDeepEqual(assertion) {
|
|
15
|
+
return comparisonOutcome(comparePartialValue(assertion.actual, assertion.expected));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=partial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/partial.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAyB,MAAM,4BAA4B,CAAC;AAgBtF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,wBAAwB,EAAE,6CAA6C;IACvE,4BAA4B,EAAE,gDAAgD;IAC9E,oBAAoB,EAAE,oCAAoC;CACpD,CAAC;AAEX,MAAM,UAAU,4BAA4B,CAAC,SAA4C;IACrF,OAAO,iBAAiB,CAAC,2BAA2B,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,SAA+C;IAC3F,OAAO,iBAAiB,CAAC,8BAA8B,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnG,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,SAAwC;IAC7E,OAAO,iBAAiB,CAAC,mBAAmB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { ActualAssertionNode, AssertionSource } from '../assertion-node-shape.ts';
|
|
3
|
+
export type DefinedAssertionNode<Source extends AssertionSource = AssertionSource> = ActualAssertionNode<Source, 'defined'>;
|
|
4
|
+
export type NullAssertionNode<Source extends AssertionSource = AssertionSource> = ActualAssertionNode<Source, 'null'>;
|
|
5
|
+
export type NotNullAssertionNode<Source extends AssertionSource = AssertionSource> = ActualAssertionNode<Source, 'not-null'>;
|
|
6
|
+
export type UndefinedAssertionNode<Source extends AssertionSource = AssertionSource> = ActualAssertionNode<Source, 'undefined'>;
|
|
7
|
+
export declare const presenceSummaryByCheck: {
|
|
8
|
+
readonly defined: "Expected value to be defined.";
|
|
9
|
+
readonly 'not-null': "Expected value not to be null.";
|
|
10
|
+
readonly null: "Expected value to be null.";
|
|
11
|
+
readonly undefined: "Expected value to be undefined.";
|
|
12
|
+
};
|
|
13
|
+
export declare function evaluateDefined(assertion: DefinedAssertionNode): AssertionOutcome;
|
|
14
|
+
export declare function evaluateNotNull(assertion: NotNullAssertionNode): AssertionOutcome;
|
|
15
|
+
export declare function evaluateNull(assertion: NullAssertionNode): AssertionOutcome;
|
|
16
|
+
export declare function evaluateUndefined(assertion: UndefinedAssertionNode): AssertionOutcome;
|
|
17
|
+
//# sourceMappingURL=presence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/presence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEvF,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,mBAAmB,CACpG,MAAM,EACN,SAAS,CACZ,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtH,MAAM,MAAM,oBAAoB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,mBAAmB,CACpG,MAAM,EACN,UAAU,CACb,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI,mBAAmB,CACtG,MAAM,EACN,WAAW,CACd,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,wBAAgB,eAAe,CAAC,SAAS,EAAE,oBAAoB,GAAG,gBAAgB,CAMjF;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,oBAAoB,GAAG,gBAAgB,CAEjF;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE3E;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,sBAAsB,GAAG,gBAAgB,CAErF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { assertionOutcome } from "../assertion-evaluation.js";
|
|
2
|
+
export const presenceSummaryByCheck = {
|
|
3
|
+
defined: 'Expected value to be defined.',
|
|
4
|
+
'not-null': 'Expected value not to be null.',
|
|
5
|
+
null: 'Expected value to be null.',
|
|
6
|
+
undefined: 'Expected value to be undefined.'
|
|
7
|
+
};
|
|
8
|
+
export function evaluateDefined(assertion) {
|
|
9
|
+
return assertionOutcome(assertion.actual, 'non-nullish value', assertion.actual !== null && assertion.actual !== undefined);
|
|
10
|
+
}
|
|
11
|
+
export function evaluateNotNull(assertion) {
|
|
12
|
+
return assertionOutcome(assertion.actual, 'not null', assertion.actual !== null);
|
|
13
|
+
}
|
|
14
|
+
export function evaluateNull(assertion) {
|
|
15
|
+
return assertionOutcome(assertion.actual, null, assertion.actual === null);
|
|
16
|
+
}
|
|
17
|
+
export function evaluateUndefined(assertion) {
|
|
18
|
+
return assertionOutcome(assertion.actual, undefined, assertion.actual === undefined);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=presence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/presence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAoBrF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,OAAO,EAAE,+BAA+B;IACxC,UAAU,EAAE,gCAAgC;IAC5C,IAAI,EAAE,4BAA4B;IAClC,SAAS,EAAE,iCAAiC;CACtC,CAAC;AAEX,MAAM,UAAU,eAAe,CAAC,SAA+B;IAC3D,OAAO,gBAAgB,CACnB,SAAS,CAAC,MAAM,EAChB,mBAAmB,EACnB,SAAS,CAAC,MAAM,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAC9D,CAAC;AACN,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAA+B;IAC3D,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,SAA4B;IACrD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAiC;IAC/D,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { AssertionSource, ExpectedAssertionNode, ResolvableSourceLocation } from '../assertion-node-shape.ts';
|
|
3
|
+
export type MatchAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
4
|
+
readonly [Check in 'match' | 'not-match']: {
|
|
5
|
+
readonly actual: unknown;
|
|
6
|
+
readonly check: Check;
|
|
7
|
+
readonly location: ResolvableSourceLocation;
|
|
8
|
+
readonly message: string | null;
|
|
9
|
+
readonly pattern: RegExp;
|
|
10
|
+
readonly source: Source;
|
|
11
|
+
};
|
|
12
|
+
}['match' | 'not-match'];
|
|
13
|
+
export type StringContainsAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
14
|
+
readonly [Check in 'ends-with' | 'includes' | 'starts-with']: ExpectedAssertionNode<Source, Check>;
|
|
15
|
+
}['ends-with' | 'includes' | 'starts-with'];
|
|
16
|
+
export declare const stringSummaryByCheck: {
|
|
17
|
+
readonly 'ends-with': "Expected string to end with the value.";
|
|
18
|
+
readonly includes: "Expected string to include the value.";
|
|
19
|
+
readonly match: "Expected string to match the pattern.";
|
|
20
|
+
readonly 'not-match': "Expected string not to match the pattern.";
|
|
21
|
+
readonly 'starts-with': "Expected string to start with the value.";
|
|
22
|
+
};
|
|
23
|
+
export declare function evaluateEndsWith(assertion: StringContainsAssertionNode): AssertionOutcome;
|
|
24
|
+
export declare function evaluateIncludes(assertion: StringContainsAssertionNode): AssertionOutcome;
|
|
25
|
+
export declare function evaluateMatch(assertion: MatchAssertionNode): AssertionOutcome;
|
|
26
|
+
export declare function evaluateNotMatch(assertion: MatchAssertionNode): AssertionOutcome;
|
|
27
|
+
export declare function evaluateStartsWith(assertion: StringContainsAssertionNode): AssertionOutcome;
|
|
28
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEnH,MAAM,MAAM,kBAAkB,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI;IAC/E,QAAQ,EAAE,KAAK,IAAI,OAAO,GAAG,WAAW,GAAG;QACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;QAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KAC3B;CACJ,CAAC,OAAO,GAAG,WAAW,CAAC,CAAC;AAEzB,MAAM,MAAM,2BAA2B,CAAC,MAAM,SAAS,eAAe,GAAG,eAAe,IAAI;IACxF,QAAQ,EAAE,KAAK,IAAI,WAAW,GAAG,UAAU,GAAG,aAAa,GAAG,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC;CACrG,CAAC,WAAW,GAAG,UAAU,GAAG,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,oBAAoB;;;;;;CAMvB,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,2BAA2B,GAAG,gBAAgB,CAMzF;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,2BAA2B,GAAG,gBAAgB,CAMzF;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,kBAAkB,GAAG,gBAAgB,CAM7E;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,kBAAkB,GAAG,gBAAgB,CAMhF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,2BAA2B,GAAG,gBAAgB,CAM3F"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { assertionOutcome } from "../assertion-evaluation.js";
|
|
2
|
+
export const stringSummaryByCheck = {
|
|
3
|
+
'ends-with': 'Expected string to end with the value.',
|
|
4
|
+
includes: 'Expected string to include the value.',
|
|
5
|
+
match: 'Expected string to match the pattern.',
|
|
6
|
+
'not-match': 'Expected string not to match the pattern.',
|
|
7
|
+
'starts-with': 'Expected string to start with the value.'
|
|
8
|
+
};
|
|
9
|
+
export function evaluateEndsWith(assertion) {
|
|
10
|
+
const passed = typeof assertion.actual === 'string' &&
|
|
11
|
+
typeof assertion.expected === 'string' &&
|
|
12
|
+
assertion.actual.endsWith(assertion.expected);
|
|
13
|
+
return assertionOutcome(assertion.actual, assertion.expected, passed);
|
|
14
|
+
}
|
|
15
|
+
export function evaluateIncludes(assertion) {
|
|
16
|
+
const passed = typeof assertion.actual === 'string' &&
|
|
17
|
+
typeof assertion.expected === 'string' &&
|
|
18
|
+
assertion.actual.includes(assertion.expected);
|
|
19
|
+
return assertionOutcome(assertion.actual, assertion.expected, passed);
|
|
20
|
+
}
|
|
21
|
+
export function evaluateMatch(assertion) {
|
|
22
|
+
return assertionOutcome(assertion.actual, assertion.pattern, typeof assertion.actual === 'string' && assertion.pattern.test(assertion.actual));
|
|
23
|
+
}
|
|
24
|
+
export function evaluateNotMatch(assertion) {
|
|
25
|
+
return assertionOutcome(assertion.actual, assertion.pattern, typeof assertion.actual === 'string' && !assertion.pattern.test(assertion.actual));
|
|
26
|
+
}
|
|
27
|
+
export function evaluateStartsWith(assertion) {
|
|
28
|
+
const passed = typeof assertion.actual === 'string' &&
|
|
29
|
+
typeof assertion.expected === 'string' &&
|
|
30
|
+
assertion.actual.startsWith(assertion.expected);
|
|
31
|
+
return assertionOutcome(assertion.actual, assertion.expected, passed);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAkBrF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,WAAW,EAAE,wCAAwC;IACrD,QAAQ,EAAE,uCAAuC;IACjD,KAAK,EAAE,uCAAuC;IAC9C,WAAW,EAAE,2CAA2C;IACxD,aAAa,EAAE,0CAA0C;CACnD,CAAC;AAEX,MAAM,UAAU,gBAAgB,CAAC,SAAsC;IACnE,MAAM,MAAM,GAAG,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ;QAC/C,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAElD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAsC;IACnE,MAAM,MAAM,GAAG,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ;QAC/C,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAElD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAA6B;IACvD,OAAO,gBAAgB,CACnB,SAAS,CAAC,MAAM,EAChB,SAAS,CAAC,OAAO,EACjB,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACnF,CAAC;AACN,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAA6B;IAC1D,OAAO,gBAAgB,CACnB,SAAS,CAAC,MAAM,EAChB,SAAS,CAAC,OAAO,EACjB,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CACpF,CAAC;AACN,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,SAAsC;IACrE,MAAM,MAAM,GAAG,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ;QAC/C,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAEpD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type AssertionOutcome } from '../assertion-evaluation.ts';
|
|
2
|
+
import type { ActualAssertionNode, AssertionSource, InstanceConstructor, ResolvableSourceLocation } from '../assertion-node-shape.ts';
|
|
3
|
+
type TypeAssertionCheck = 'array' | 'boolean' | 'function' | 'number' | 'object' | 'string';
|
|
4
|
+
export type TypeAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
5
|
+
readonly [Check in TypeAssertionCheck]: ActualAssertionNode<Source, Check>;
|
|
6
|
+
}[TypeAssertionCheck];
|
|
7
|
+
export type InstanceOfAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
8
|
+
readonly actual: unknown;
|
|
9
|
+
readonly check: 'instance-of';
|
|
10
|
+
readonly expected: InstanceConstructor;
|
|
11
|
+
readonly location: ResolvableSourceLocation;
|
|
12
|
+
readonly message: string | null;
|
|
13
|
+
readonly source: Source;
|
|
14
|
+
};
|
|
15
|
+
export type HasPropertyAssertionNode<Source extends AssertionSource = AssertionSource> = {
|
|
16
|
+
readonly actual: unknown;
|
|
17
|
+
readonly check: 'has-property';
|
|
18
|
+
readonly key: PropertyKey;
|
|
19
|
+
readonly location: ResolvableSourceLocation;
|
|
20
|
+
readonly message: string | null;
|
|
21
|
+
readonly source: Source;
|
|
22
|
+
};
|
|
23
|
+
export declare const typeShapeSummaryByCheck: {
|
|
24
|
+
readonly array: "Expected value to be an array.";
|
|
25
|
+
readonly boolean: "Expected value to be a boolean.";
|
|
26
|
+
readonly function: "Expected value to be a function.";
|
|
27
|
+
readonly 'has-property': "Expected object to have the own property.";
|
|
28
|
+
readonly 'instance-of': "Expected value to be an instance of the constructor.";
|
|
29
|
+
readonly number: "Expected value to be a number.";
|
|
30
|
+
readonly object: "Expected value to be an object.";
|
|
31
|
+
readonly string: "Expected value to be a string.";
|
|
32
|
+
};
|
|
33
|
+
export declare function evaluateArray(assertion: TypeAssertionNode): AssertionOutcome;
|
|
34
|
+
export declare function evaluateBoolean(assertion: TypeAssertionNode): AssertionOutcome;
|
|
35
|
+
export declare function evaluateFunction(assertion: TypeAssertionNode): AssertionOutcome;
|
|
36
|
+
export declare function evaluateHasProperty(assertion: HasPropertyAssertionNode): AssertionOutcome;
|
|
37
|
+
export declare function evaluateInstanceOf(assertion: InstanceOfAssertionNode): AssertionOutcome;
|
|
38
|
+
export declare function evaluateNumber(assertion: TypeAssertionNode): AssertionOutcome;
|
|
39
|
+
export declare function evaluateObject(assertion: TypeAssertionNode): AssertionOutcome;
|
|
40
|
+
export declare function evaluateString(assertion: TypeAssertionNode): AssertionOutcome;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=type-shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-shape.d.ts","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assert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;;;;;;CAS1B,CAAC;AAUX,wBAAgB,aAAa,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE5E;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE9E;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE/E;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,wBAAwB,GAAG,gBAAgB,CAMzF;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,uBAAuB,GAAG,gBAAgB,CAEvF;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE7E;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE7E;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,iBAAiB,GAAG,gBAAgB,CAE7E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { assertionOutcome } from "../assertion-evaluation.js";
|
|
2
|
+
import { isPlainObject } from "../partial-matching.js";
|
|
3
|
+
export const typeShapeSummaryByCheck = {
|
|
4
|
+
array: 'Expected value to be an array.',
|
|
5
|
+
boolean: 'Expected value to be a boolean.',
|
|
6
|
+
function: 'Expected value to be a function.',
|
|
7
|
+
'has-property': 'Expected object to have the own property.',
|
|
8
|
+
'instance-of': 'Expected value to be an instance of the constructor.',
|
|
9
|
+
number: 'Expected value to be a number.',
|
|
10
|
+
object: 'Expected value to be an object.',
|
|
11
|
+
string: 'Expected value to be a string.'
|
|
12
|
+
};
|
|
13
|
+
function isFiniteNumber(value) {
|
|
14
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
15
|
+
}
|
|
16
|
+
function isSupportedObject(value) {
|
|
17
|
+
return typeof value === 'object' && value !== null;
|
|
18
|
+
}
|
|
19
|
+
export function evaluateArray(assertion) {
|
|
20
|
+
return assertionOutcome(assertion.actual, 'array', Array.isArray(assertion.actual));
|
|
21
|
+
}
|
|
22
|
+
export function evaluateBoolean(assertion) {
|
|
23
|
+
return assertionOutcome(assertion.actual, 'boolean', typeof assertion.actual === 'boolean');
|
|
24
|
+
}
|
|
25
|
+
export function evaluateFunction(assertion) {
|
|
26
|
+
return assertionOutcome(assertion.actual, 'function', typeof assertion.actual === 'function');
|
|
27
|
+
}
|
|
28
|
+
export function evaluateHasProperty(assertion) {
|
|
29
|
+
return assertionOutcome(assertion.actual, `own property ${String(assertion.key)}`, isSupportedObject(assertion.actual) && Object.hasOwn(assertion.actual, assertion.key));
|
|
30
|
+
}
|
|
31
|
+
export function evaluateInstanceOf(assertion) {
|
|
32
|
+
return assertionOutcome(assertion.actual, assertion.expected, assertion.actual instanceof assertion.expected);
|
|
33
|
+
}
|
|
34
|
+
export function evaluateNumber(assertion) {
|
|
35
|
+
return assertionOutcome(assertion.actual, 'finite number', isFiniteNumber(assertion.actual));
|
|
36
|
+
}
|
|
37
|
+
export function evaluateObject(assertion) {
|
|
38
|
+
return assertionOutcome(assertion.actual, 'plain object', isPlainObject(assertion.actual));
|
|
39
|
+
}
|
|
40
|
+
export function evaluateString(assertion) {
|
|
41
|
+
return assertionOutcome(assertion.actual, 'string', typeof assertion.actual === 'string');
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=type-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-shape.js","sourceRoot":"","sources":["../../../../../source/assertion-protocol/assertions/type-shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAyB,MAAM,4BAA4B,CAAC;AAOrF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AA0BvD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,KAAK,EAAE,gCAAgC;IACvC,OAAO,EAAE,iCAAiC;IAC1C,QAAQ,EAAE,kCAAkC;IAC5C,cAAc,EAAE,2CAA2C;IAC3D,aAAa,EAAE,sDAAsD;IACrE,MAAM,EAAE,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S,CAAC,QAAQ,CAAC,CAAC;AAClH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAA4B;IACvD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,eAAe,EAAE,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAA4B;IACvD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAA4B;IACvD,OAAO,gBAAgB,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-count.d.ts","sourceRoot":"","sources":["../../../../source/assertion-protocol/collection-count.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC/B,CAAC;AA8CF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAYhF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isPlainObject, ownKeys } from "./partial-matching.js";
|
|
2
|
+
function isObject(value) {
|
|
3
|
+
return typeof value === 'object' && value !== null;
|
|
4
|
+
}
|
|
5
|
+
function hasIteratorProvider(value) {
|
|
6
|
+
return typeof Reflect.get(value, Symbol.iterator) === 'function';
|
|
7
|
+
}
|
|
8
|
+
function iterableItems(value) {
|
|
9
|
+
if (!isObject(value) || !hasIteratorProvider(value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return value[Symbol.iterator]();
|
|
13
|
+
}
|
|
14
|
+
function countIterator(iterator, limit) {
|
|
15
|
+
let count = 0;
|
|
16
|
+
let item = iterator.next();
|
|
17
|
+
while (item.done !== true && count < limit) {
|
|
18
|
+
count += 1;
|
|
19
|
+
item = iterator.next();
|
|
20
|
+
}
|
|
21
|
+
return count;
|
|
22
|
+
}
|
|
23
|
+
function knownCollectionCount(value) {
|
|
24
|
+
if (typeof value === 'string' || Array.isArray(value)) {
|
|
25
|
+
return value.length;
|
|
26
|
+
}
|
|
27
|
+
if (value instanceof Map || value instanceof Set) {
|
|
28
|
+
return value.size;
|
|
29
|
+
}
|
|
30
|
+
return isPlainObject(value) ? ownKeys(value).length : null;
|
|
31
|
+
}
|
|
32
|
+
export function collectionCount(value, limit) {
|
|
33
|
+
const knownCount = knownCollectionCount(value);
|
|
34
|
+
if (knownCount !== null) {
|
|
35
|
+
return { count: knownCount, supported: true };
|
|
36
|
+
}
|
|
37
|
+
const iterator = iterableItems(value);
|
|
38
|
+
return iterator === null
|
|
39
|
+
? { count: 0, supported: false }
|
|
40
|
+
: { count: countIterator(iterator, limit), supported: true };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=collection-count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-count.js","sourceRoot":"","sources":["../../../../source/assertion-protocol/collection-count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO/D,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACvD,CAAC;AAMD,SAAS,mBAAmB,CAAC,KAA8B;IACvD,OAAO,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC;AACrE,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,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,IAAI;QACpB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;QAChC,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AssertionNode, type CompositeAssertionChildNode } from './assertion-node.ts';
|
|
2
|
+
import type { FailedCheck } from './assertion-node-shape.ts';
|
|
3
|
+
type DeepAssertionCheckByName = {
|
|
4
|
+
readonly arrayContainsPartial: 'array-contains-partial';
|
|
5
|
+
readonly deepEqual: 'deep-equal';
|
|
6
|
+
readonly membersPartialDeepEqual: 'members-partial-deep-equal';
|
|
7
|
+
readonly notDeepEqual: 'not-deep-equal';
|
|
8
|
+
readonly partialDeepEqual: 'partial-deep-equal';
|
|
9
|
+
};
|
|
10
|
+
type DeepAssertionCheck = DeepAssertionCheckByName[keyof DeepAssertionCheckByName];
|
|
11
|
+
type DeepAssertionOperandRole = 'actual' | 'expected';
|
|
12
|
+
type PrimitiveValueTypeByName = {
|
|
13
|
+
readonly bigint: 'bigint';
|
|
14
|
+
readonly boolean: 'boolean';
|
|
15
|
+
readonly null: 'null';
|
|
16
|
+
readonly number: 'number';
|
|
17
|
+
readonly string: 'string';
|
|
18
|
+
readonly symbol: 'symbol';
|
|
19
|
+
readonly undefined: 'undefined';
|
|
20
|
+
};
|
|
21
|
+
type PrimitiveValueType = PrimitiveValueTypeByName[keyof PrimitiveValueTypeByName];
|
|
22
|
+
export type InvalidDeepAssertionOperand = {
|
|
23
|
+
readonly check: DeepAssertionCheck;
|
|
24
|
+
readonly index: number | null;
|
|
25
|
+
readonly role: DeepAssertionOperandRole;
|
|
26
|
+
readonly type: PrimitiveValueType;
|
|
27
|
+
};
|
|
28
|
+
export declare function invalidDeepAssertionOperand(assertion: AssertionNode | CompositeAssertionChildNode): InvalidDeepAssertionOperand | null;
|
|
29
|
+
export declare function evaluateAssertion(assertion: AssertionNode | CompositeAssertionChildNode, id: number | string): FailedCheck | null;
|
|
30
|
+
export declare function assertionPasses(assertion: AssertionNode): boolean;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=evaluation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../../../source/assertion-protocol/evaluation.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,aAAa,EAElB,KAAK,2BAA2B,EAGnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAmB,WAAW,EAAyB,MAAM,2BAA2B,CAAC;AAIrG,KAAK,wBAAwB,GAAG;IAC5B,QAAQ,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;IACxD,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,uBAAuB,EAAE,4BAA4B,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;CACnD,CAAC;AAEF,KAAK,kBAAkB,GAAG,wBAAwB,CAAC,MAAM,wBAAwB,CAAC,CAAC;AAEnF,KAAK,wBAAwB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtD,KAAK,wBAAwB,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACnC,CAAC;AAEF,KAAK,kBAAkB,GAAG,wBAAwB,CAAC,MAAM,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