@thisisagile/easy-test 15.8.5 → 15.8.7
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/dist/index.d.ts +2 -379
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -0
- package/dist/matchers/Check.d.ts +17 -0
- package/dist/matchers/Check.js +64 -0
- package/dist/matchers/Check.js.map +1 -0
- package/dist/matchers/Check.mjs +39 -0
- package/dist/matchers/Check.mjs.map +1 -0
- package/dist/matchers/HttpMatchers.d.ts +31 -0
- package/dist/matchers/HttpMatchers.js +89 -0
- package/dist/matchers/HttpMatchers.js.map +1 -0
- package/dist/matchers/HttpMatchers.mjs +54 -0
- package/dist/matchers/HttpMatchers.mjs.map +1 -0
- package/dist/matchers/Match.d.ts +12 -0
- package/dist/matchers/Match.js +59 -0
- package/dist/matchers/Match.js.map +1 -0
- package/dist/matchers/Match.mjs +34 -0
- package/dist/matchers/Match.mjs.map +1 -0
- package/dist/matchers/ResultMatchers.d.ts +13 -0
- package/dist/matchers/ResultMatchers.js +51 -0
- package/dist/matchers/ResultMatchers.js.map +1 -0
- package/dist/matchers/ResultMatchers.mjs +25 -0
- package/dist/matchers/ResultMatchers.mjs.map +1 -0
- package/dist/matchers/index.d.ts +19 -0
- package/dist/matchers/index.js +59 -0
- package/dist/matchers/index.js.map +1 -0
- package/dist/matchers/index.mjs +20 -0
- package/dist/matchers/index.mjs.map +1 -0
- package/dist/matchers/toBeArrayOf.d.ts +9 -0
- package/dist/matchers/toBeArrayOf.js +33 -0
- package/dist/matchers/toBeArrayOf.js.map +1 -0
- package/dist/matchers/toBeArrayOf.mjs +9 -0
- package/dist/matchers/toBeArrayOf.mjs.map +1 -0
- package/dist/matchers/toBeArrayOfWithLength.d.ts +9 -0
- package/dist/matchers/toBeArrayOfWithLength.js +36 -0
- package/dist/matchers/toBeArrayOfWithLength.js.map +1 -0
- package/dist/matchers/toBeArrayOfWithLength.mjs +12 -0
- package/dist/matchers/toBeArrayOfWithLength.mjs.map +1 -0
- package/dist/matchers/toBeAt.d.ts +9 -0
- package/dist/matchers/toBeAt.js +44 -0
- package/dist/matchers/toBeAt.js.map +1 -0
- package/dist/matchers/toBeAt.mjs +20 -0
- package/dist/matchers/toBeAt.mjs.map +1 -0
- package/dist/matchers/toBeExactlyAt.d.ts +9 -0
- package/dist/matchers/toBeExactlyAt.js +43 -0
- package/dist/matchers/toBeExactlyAt.js.map +1 -0
- package/dist/matchers/toBeExactlyAt.mjs +19 -0
- package/dist/matchers/toBeExactlyAt.mjs.map +1 -0
- package/dist/matchers/toBeQueriedWith.d.ts +9 -0
- package/dist/matchers/toBeQueriedWith.js +36 -0
- package/dist/matchers/toBeQueriedWith.js.map +1 -0
- package/dist/matchers/toBeQueriedWith.mjs +12 -0
- package/dist/matchers/toBeQueriedWith.mjs.map +1 -0
- package/dist/matchers/toBeRoutedTo.d.ts +9 -0
- package/dist/matchers/toBeRoutedTo.js +37 -0
- package/dist/matchers/toBeRoutedTo.js.map +1 -0
- package/dist/matchers/toBeRoutedTo.mjs +13 -0
- package/dist/matchers/toBeRoutedTo.mjs.map +1 -0
- package/dist/matchers/toBeValid.d.ts +8 -0
- package/dist/matchers/toBeValid.js +34 -0
- package/dist/matchers/toBeValid.js.map +1 -0
- package/dist/matchers/toBeValid.mjs +10 -0
- package/dist/matchers/toBeValid.mjs.map +1 -0
- package/dist/matchers/toFailMatcher.d.ts +19 -0
- package/dist/matchers/toFailMatcher.js +59 -0
- package/dist/matchers/toFailMatcher.js.map +1 -0
- package/dist/matchers/toFailMatcher.mjs +32 -0
- package/dist/matchers/toFailMatcher.mjs.map +1 -0
- package/dist/matchers/toMatchArray.d.ts +9 -0
- package/dist/matchers/toMatchArray.js +35 -0
- package/dist/matchers/toMatchArray.js.map +1 -0
- package/dist/matchers/toMatchArray.mjs +11 -0
- package/dist/matchers/toMatchArray.mjs.map +1 -0
- package/dist/matchers/toMatchExactJson.d.ts +14 -0
- package/dist/matchers/toMatchExactJson.js +42 -0
- package/dist/matchers/toMatchExactJson.js.map +1 -0
- package/dist/matchers/toMatchExactJson.mjs +17 -0
- package/dist/matchers/toMatchExactJson.mjs.map +1 -0
- package/dist/matchers/toMatchException.d.ts +9 -0
- package/dist/matchers/toMatchException.js +43 -0
- package/dist/matchers/toMatchException.js.map +1 -0
- package/dist/matchers/toMatchException.mjs +19 -0
- package/dist/matchers/toMatchException.mjs.map +1 -0
- package/dist/matchers/toMatchJson.d.ts +14 -0
- package/dist/matchers/toMatchJson.js +43 -0
- package/dist/matchers/toMatchJson.js.map +1 -0
- package/dist/matchers/toMatchJson.mjs +18 -0
- package/dist/matchers/toMatchJson.mjs.map +1 -0
- package/dist/matchers/toMatchRoute.d.ts +9 -0
- package/dist/matchers/toMatchRoute.js +37 -0
- package/dist/matchers/toMatchRoute.js.map +1 -0
- package/dist/matchers/toMatchRoute.mjs +13 -0
- package/dist/matchers/toMatchRoute.mjs.map +1 -0
- package/dist/matchers/toMatchText.d.ts +8 -0
- package/dist/matchers/toMatchText.js +37 -0
- package/dist/matchers/toMatchText.js.map +1 -0
- package/dist/matchers/toMatchText.mjs +13 -0
- package/dist/matchers/toMatchText.mjs.map +1 -0
- package/dist/matchers/toPassMatcher.d.ts +19 -0
- package/dist/matchers/toPassMatcher.js +59 -0
- package/dist/matchers/toPassMatcher.js.map +1 -0
- package/dist/matchers/toPassMatcher.mjs +32 -0
- package/dist/matchers/toPassMatcher.mjs.map +1 -0
- package/dist/mock/Fits.d.ts +24 -0
- package/dist/mock/Fits.js +71 -0
- package/dist/mock/Fits.js.map +1 -0
- package/dist/mock/Fits.mjs +44 -0
- package/dist/mock/Fits.mjs.map +1 -0
- package/dist/mock/Mocks.d.ts +39 -0
- package/dist/mock/Mocks.js +98 -0
- package/dist/mock/Mocks.js.map +1 -0
- package/dist/mock/Mocks.mjs +73 -0
- package/dist/mock/Mocks.mjs.map +1 -0
- package/dist/mock/index.d.ts +2 -0
- package/dist/mock/index.js +25 -0
- package/dist/mock/index.js.map +1 -0
- package/dist/mock/index.mjs +3 -0
- package/dist/mock/index.mjs.map +1 -0
- package/dist/utils/Eq.d.ts +5 -0
- package/dist/utils/Eq.js +35 -0
- package/dist/utils/Eq.js.map +1 -0
- package/dist/utils/Eq.mjs +11 -0
- package/dist/utils/Eq.mjs.map +1 -0
- package/dist/utils/Req.d.ts +14 -0
- package/dist/utils/Req.js +59 -0
- package/dist/utils/Req.js.map +1 -0
- package/dist/utils/Req.mjs +35 -0
- package/dist/utils/Req.mjs.map +1 -0
- package/dist/utils/Response.d.ts +25 -0
- package/dist/utils/Response.js +17 -0
- package/dist/utils/Response.js.map +1 -0
- package/dist/utils/Response.mjs +1 -0
- package/dist/utils/Response.mjs.map +1 -0
- package/dist/utils/Types.d.ts +44 -0
- package/dist/utils/Types.js +30 -0
- package/dist/utils/Types.js.map +1 -0
- package/dist/utils/Types.mjs +6 -0
- package/dist/utils/Types.mjs.map +1 -0
- package/dist/utils/Utils.d.ts +12 -0
- package/dist/utils/Utils.js +62 -0
- package/dist/utils/Utils.js.map +1 -0
- package/dist/utils/Utils.mjs +28 -0
- package/dist/utils/Utils.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/index.d.mts +0 -379
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toMatchExactJson_exports = {};
|
|
20
|
+
__export(toMatchExactJson_exports, {
|
|
21
|
+
MatchesExactJson: () => MatchesExactJson,
|
|
22
|
+
toMatchExactJson: () => toMatchExactJson
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(toMatchExactJson_exports);
|
|
25
|
+
var import_Match = require("./Match");
|
|
26
|
+
var import_Eq = require("../utils/Eq");
|
|
27
|
+
const MatchesExactJson = {
|
|
28
|
+
SubjectUndefined: "Subject is undefined.",
|
|
29
|
+
SubsetUndefined: "Object to match with is undefined.",
|
|
30
|
+
DoesNotMatch: "Object does not exactly match subject.",
|
|
31
|
+
Yes: "Object matches subject exactly"
|
|
32
|
+
};
|
|
33
|
+
const toMatchExactJson = (value, json) => (0, import_Match.match)(value).undefined((v) => v, MatchesExactJson.SubjectUndefined).undefined(() => json, MatchesExactJson.SubsetUndefined).not((v) => import_Eq.eq.exact(v, json), MatchesExactJson.DoesNotMatch).else(() => MatchesExactJson.Yes);
|
|
34
|
+
expect.extend({
|
|
35
|
+
toMatchExactJson
|
|
36
|
+
});
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
MatchesExactJson,
|
|
40
|
+
toMatchExactJson
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=toMatchExactJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchExactJson.ts"],"sourcesContent":["import { match } from './Match';\nimport { eq } from '../utils/Eq';\n\nexport const MatchesExactJson = {\n SubjectUndefined: 'Subject is undefined.',\n SubsetUndefined: 'Object to match with is undefined.',\n DoesNotMatch: 'Object does not exactly match subject.',\n Yes: 'Object matches subject exactly',\n};\n\nexport const toMatchExactJson = (value?: unknown, json?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, MatchesExactJson.SubjectUndefined)\n .undefined(() => json, MatchesExactJson.SubsetUndefined)\n .not(v => eq.exact(v, json), MatchesExactJson.DoesNotMatch)\n .else(() => MatchesExactJson.Yes);\n\nexpect.extend({\n toMatchExactJson: toMatchExactJson,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchExactJson(json?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,gBAAmB;AAEZ,MAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,mBAAmB,CAAC,OAAiB,aAChD,oBAAe,KAAK,EACjB,UAAU,OAAK,GAAG,iBAAiB,gBAAgB,EACnD,UAAU,MAAM,MAAM,iBAAiB,eAAe,EACtD,IAAI,OAAK,aAAG,MAAM,GAAG,IAAI,GAAG,iBAAiB,YAAY,EACzD,KAAK,MAAM,iBAAiB,GAAG;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { match } from "./Match";
|
|
2
|
+
import { eq } from "../utils/Eq";
|
|
3
|
+
const MatchesExactJson = {
|
|
4
|
+
SubjectUndefined: "Subject is undefined.",
|
|
5
|
+
SubsetUndefined: "Object to match with is undefined.",
|
|
6
|
+
DoesNotMatch: "Object does not exactly match subject.",
|
|
7
|
+
Yes: "Object matches subject exactly"
|
|
8
|
+
};
|
|
9
|
+
const toMatchExactJson = (value, json) => match(value).undefined((v) => v, MatchesExactJson.SubjectUndefined).undefined(() => json, MatchesExactJson.SubsetUndefined).not((v) => eq.exact(v, json), MatchesExactJson.DoesNotMatch).else(() => MatchesExactJson.Yes);
|
|
10
|
+
expect.extend({
|
|
11
|
+
toMatchExactJson
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
MatchesExactJson,
|
|
15
|
+
toMatchExactJson
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=toMatchExactJson.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchExactJson.ts"],"sourcesContent":["import { match } from './Match';\nimport { eq } from '../utils/Eq';\n\nexport const MatchesExactJson = {\n SubjectUndefined: 'Subject is undefined.',\n SubsetUndefined: 'Object to match with is undefined.',\n DoesNotMatch: 'Object does not exactly match subject.',\n Yes: 'Object matches subject exactly',\n};\n\nexport const toMatchExactJson = (value?: unknown, json?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, MatchesExactJson.SubjectUndefined)\n .undefined(() => json, MatchesExactJson.SubsetUndefined)\n .not(v => eq.exact(v, json), MatchesExactJson.DoesNotMatch)\n .else(() => MatchesExactJson.Yes);\n\nexpect.extend({\n toMatchExactJson: toMatchExactJson,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchExactJson(json?: unknown): R;\n }\n }\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,UAAU;AAEZ,MAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,mBAAmB,CAAC,OAAiB,SAChD,MAAe,KAAK,EACjB,UAAU,OAAK,GAAG,iBAAiB,gBAAgB,EACnD,UAAU,MAAM,MAAM,iBAAiB,eAAe,EACtD,IAAI,OAAK,GAAG,MAAM,GAAG,IAAI,GAAG,iBAAiB,YAAY,EACzD,KAAK,MAAM,iBAAiB,GAAG;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exception } from '../utils/Types';
|
|
2
|
+
export declare const toMatchException: (received: Exception, expected: unknown, reason?: string) => jest.CustomMatcherResult;
|
|
3
|
+
declare global {
|
|
4
|
+
namespace jest {
|
|
5
|
+
interface Matchers<R, T> {
|
|
6
|
+
toMatchException(exception: unknown, reason?: string): R;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toMatchException_exports = {};
|
|
20
|
+
__export(toMatchException_exports, {
|
|
21
|
+
toMatchException: () => toMatchException
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(toMatchException_exports);
|
|
24
|
+
var import_Match = require("./Match");
|
|
25
|
+
var import_Utils = require("../utils/Utils");
|
|
26
|
+
const toMatchException = (received, expected, reason) => (0, import_Match.match)(expected).undefined((e) => e.id, "Expected value is not an exception.").not(
|
|
27
|
+
(e) => e.id === received.id,
|
|
28
|
+
(e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`
|
|
29
|
+
).not(
|
|
30
|
+
() => !(0, import_Utils.isDefined)(reason) || (0, import_Utils.isDefined)(reason) && (0, import_Utils.isDefined)(received.reason),
|
|
31
|
+
() => `We expected to have reason '${reason}', but we received no reason.`
|
|
32
|
+
).not(
|
|
33
|
+
() => !(0, import_Utils.isDefined)(reason) || (0, import_Utils.isDefined)(reason) && received.reason === reason,
|
|
34
|
+
() => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`
|
|
35
|
+
).else(`Expected exception matches received exception`);
|
|
36
|
+
expect.extend({
|
|
37
|
+
toMatchException
|
|
38
|
+
});
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
toMatchException
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=toMatchException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchException.ts"],"sourcesContent":["import { Exception } from '../utils/Types';\nimport { match } from './Match';\nimport { isDefined } from '../utils/Utils';\n\nexport const toMatchException = (received: Exception, expected: unknown, reason?: string): jest.CustomMatcherResult =>\n match<Exception>(expected as Exception)\n .undefined(e => e.id, 'Expected value is not an exception.')\n .not(\n e => e.id === received.id,\n e => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`\n )\n .not(\n () => !isDefined(reason) || (isDefined(reason) && isDefined(received.reason)),\n () => `We expected to have reason '${reason}', but we received no reason.`\n )\n .not(\n () => !isDefined(reason) || (isDefined(reason) && received.reason === reason),\n () => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`\n )\n .else(`Expected exception matches received exception`);\n\nexpect.extend({\n toMatchException,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchException(exception: unknown, reason?: string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsB;AACtB,mBAA0B;AAEnB,MAAM,mBAAmB,CAAC,UAAqB,UAAmB,eACvE,oBAAiB,QAAqB,EACnC,UAAU,OAAK,EAAE,IAAI,qCAAqC,EAC1D;AAAA,EACC,OAAK,EAAE,OAAO,SAAS;AAAA,EACvB,OAAK,8BAA8B,EAAE,EAAE,2CAA2C,SAAS,EAAE;AAC/F,EACC;AAAA,EACC,MAAM,KAAC,wBAAU,MAAM,SAAM,wBAAU,MAAM,SAAK,wBAAU,SAAS,MAAM;AAAA,EAC3E,MAAM,+BAA+B,MAAM;AAC7C,EACC;AAAA,EACC,MAAM,KAAC,wBAAU,MAAM,SAAM,wBAAU,MAAM,KAAK,SAAS,WAAW;AAAA,EACtE,MAAM,+BAA+B,MAAM,8BAA8B,SAAS,MAAM;AAC1F,EACC,KAAK,+CAA+C;AAEzD,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { match } from "./Match";
|
|
2
|
+
import { isDefined } from "../utils/Utils";
|
|
3
|
+
const toMatchException = (received, expected, reason) => match(expected).undefined((e) => e.id, "Expected value is not an exception.").not(
|
|
4
|
+
(e) => e.id === received.id,
|
|
5
|
+
(e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`
|
|
6
|
+
).not(
|
|
7
|
+
() => !isDefined(reason) || isDefined(reason) && isDefined(received.reason),
|
|
8
|
+
() => `We expected to have reason '${reason}', but we received no reason.`
|
|
9
|
+
).not(
|
|
10
|
+
() => !isDefined(reason) || isDefined(reason) && received.reason === reason,
|
|
11
|
+
() => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`
|
|
12
|
+
).else(`Expected exception matches received exception`);
|
|
13
|
+
expect.extend({
|
|
14
|
+
toMatchException
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
toMatchException
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=toMatchException.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchException.ts"],"sourcesContent":["import { Exception } from '../utils/Types';\nimport { match } from './Match';\nimport { isDefined } from '../utils/Utils';\n\nexport const toMatchException = (received: Exception, expected: unknown, reason?: string): jest.CustomMatcherResult =>\n match<Exception>(expected as Exception)\n .undefined(e => e.id, 'Expected value is not an exception.')\n .not(\n e => e.id === received.id,\n e => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`\n )\n .not(\n () => !isDefined(reason) || (isDefined(reason) && isDefined(received.reason)),\n () => `We expected to have reason '${reason}', but we received no reason.`\n )\n .not(\n () => !isDefined(reason) || (isDefined(reason) && received.reason === reason),\n () => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`\n )\n .else(`Expected exception matches received exception`);\n\nexpect.extend({\n toMatchException,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchException(exception: unknown, reason?: string): R;\n }\n }\n}\n"],"mappings":"AACA,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAEnB,MAAM,mBAAmB,CAAC,UAAqB,UAAmB,WACvE,MAAiB,QAAqB,EACnC,UAAU,OAAK,EAAE,IAAI,qCAAqC,EAC1D;AAAA,EACC,OAAK,EAAE,OAAO,SAAS;AAAA,EACvB,OAAK,8BAA8B,EAAE,EAAE,2CAA2C,SAAS,EAAE;AAC/F,EACC;AAAA,EACC,MAAM,CAAC,UAAU,MAAM,KAAM,UAAU,MAAM,KAAK,UAAU,SAAS,MAAM;AAAA,EAC3E,MAAM,+BAA+B,MAAM;AAC7C,EACC;AAAA,EACC,MAAM,CAAC,UAAU,MAAM,KAAM,UAAU,MAAM,KAAK,SAAS,WAAW;AAAA,EACtE,MAAM,+BAA+B,MAAM,8BAA8B,SAAS,MAAM;AAC1F,EACC,KAAK,+CAA+C;AAEzD,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const MatchesJson: {
|
|
2
|
+
SubjectUndefined: string;
|
|
3
|
+
SubsetUndefined: string;
|
|
4
|
+
DoesNotMatch: string;
|
|
5
|
+
Yes: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const toMatchJson: (value?: unknown, subset?: unknown) => jest.CustomMatcherResult;
|
|
8
|
+
declare global {
|
|
9
|
+
namespace jest {
|
|
10
|
+
interface Matchers<R, T> {
|
|
11
|
+
toMatchJson(subset?: unknown): R;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toMatchJson_exports = {};
|
|
20
|
+
__export(toMatchJson_exports, {
|
|
21
|
+
MatchesJson: () => MatchesJson,
|
|
22
|
+
toMatchJson: () => toMatchJson
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(toMatchJson_exports);
|
|
25
|
+
var import_Match = require("./Match");
|
|
26
|
+
var import_Eq = require("../utils/Eq");
|
|
27
|
+
var import_Utils = require("../utils/Utils");
|
|
28
|
+
const MatchesJson = {
|
|
29
|
+
SubjectUndefined: "Subject is undefined.",
|
|
30
|
+
SubsetUndefined: "Subset to match with is undefined.",
|
|
31
|
+
DoesNotMatch: "Subset does not match subject.",
|
|
32
|
+
Yes: "Subset matches subject"
|
|
33
|
+
};
|
|
34
|
+
const toMatchJson = (value, subset) => (0, import_Match.match)(value).undefined((v) => v, MatchesJson.SubjectUndefined).undefined(() => subset, MatchesJson.SubsetUndefined).not((v) => import_Eq.eq.subset((0, import_Utils.asJson)(v), (0, import_Utils.asJson)(subset)), MatchesJson.DoesNotMatch).else(() => MatchesJson.Yes);
|
|
35
|
+
expect.extend({
|
|
36
|
+
toMatchJson
|
|
37
|
+
});
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
MatchesJson,
|
|
41
|
+
toMatchJson
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=toMatchJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchJson.ts"],"sourcesContent":["import { match } from './Match';\nimport { eq } from '../utils/Eq';\nimport { asJson } from '../utils/Utils';\n\nexport const MatchesJson = {\n SubjectUndefined: 'Subject is undefined.',\n SubsetUndefined: 'Subset to match with is undefined.',\n DoesNotMatch: 'Subset does not match subject.',\n Yes: 'Subset matches subject',\n};\n\nexport const toMatchJson = (value?: unknown, subset?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, MatchesJson.SubjectUndefined)\n .undefined(() => subset, MatchesJson.SubsetUndefined)\n .not(v => eq.subset(asJson(v), asJson(subset)), MatchesJson.DoesNotMatch)\n .else(() => MatchesJson.Yes);\n\nexpect.extend({\n toMatchJson: toMatchJson,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchJson(subset?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,gBAAmB;AACnB,mBAAuB;AAEhB,MAAM,cAAc;AAAA,EACzB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,cAAc,CAAC,OAAiB,eAC3C,oBAAe,KAAK,EACjB,UAAU,OAAK,GAAG,YAAY,gBAAgB,EAC9C,UAAU,MAAM,QAAQ,YAAY,eAAe,EACnD,IAAI,OAAK,aAAG,WAAO,qBAAO,CAAC,OAAG,qBAAO,MAAM,CAAC,GAAG,YAAY,YAAY,EACvE,KAAK,MAAM,YAAY,GAAG;AAE/B,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { match } from "./Match";
|
|
2
|
+
import { eq } from "../utils/Eq";
|
|
3
|
+
import { asJson } from "../utils/Utils";
|
|
4
|
+
const MatchesJson = {
|
|
5
|
+
SubjectUndefined: "Subject is undefined.",
|
|
6
|
+
SubsetUndefined: "Subset to match with is undefined.",
|
|
7
|
+
DoesNotMatch: "Subset does not match subject.",
|
|
8
|
+
Yes: "Subset matches subject"
|
|
9
|
+
};
|
|
10
|
+
const toMatchJson = (value, subset) => match(value).undefined((v) => v, MatchesJson.SubjectUndefined).undefined(() => subset, MatchesJson.SubsetUndefined).not((v) => eq.subset(asJson(v), asJson(subset)), MatchesJson.DoesNotMatch).else(() => MatchesJson.Yes);
|
|
11
|
+
expect.extend({
|
|
12
|
+
toMatchJson
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
MatchesJson,
|
|
16
|
+
toMatchJson
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=toMatchJson.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchJson.ts"],"sourcesContent":["import { match } from './Match';\nimport { eq } from '../utils/Eq';\nimport { asJson } from '../utils/Utils';\n\nexport const MatchesJson = {\n SubjectUndefined: 'Subject is undefined.',\n SubsetUndefined: 'Subset to match with is undefined.',\n DoesNotMatch: 'Subset does not match subject.',\n Yes: 'Subset matches subject',\n};\n\nexport const toMatchJson = (value?: unknown, subset?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, MatchesJson.SubjectUndefined)\n .undefined(() => subset, MatchesJson.SubsetUndefined)\n .not(v => eq.subset(asJson(v), asJson(subset)), MatchesJson.DoesNotMatch)\n .else(() => MatchesJson.Yes);\n\nexpect.extend({\n toMatchJson: toMatchJson,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchJson(subset?: unknown): R;\n }\n }\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,UAAU;AACnB,SAAS,cAAc;AAEhB,MAAM,cAAc;AAAA,EACzB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,cAAc,CAAC,OAAiB,WAC3C,MAAe,KAAK,EACjB,UAAU,OAAK,GAAG,YAAY,gBAAgB,EAC9C,UAAU,MAAM,QAAQ,YAAY,eAAe,EACnD,IAAI,OAAK,GAAG,OAAO,OAAO,CAAC,GAAG,OAAO,MAAM,CAAC,GAAG,YAAY,YAAY,EACvE,KAAK,MAAM,YAAY,GAAG;AAE/B,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toMatchRoute_exports = {};
|
|
20
|
+
__export(toMatchRoute_exports, {
|
|
21
|
+
toMatchRoute: () => toMatchRoute
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(toMatchRoute_exports);
|
|
24
|
+
var import_Match = require("./Match");
|
|
25
|
+
var import_Utils = require("../utils/Utils");
|
|
26
|
+
const toMatchRoute = (uri, route) => (0, import_Match.match)(uri).undefined((u) => u, "Subject is undefined.").undefined(() => route, "Route to include is undefined.").not(
|
|
27
|
+
(u) => (0, import_Utils.asString)(u).includes((0, import_Utils.asString)(route)),
|
|
28
|
+
(u) => `Uri '${u}' does not include '${route}'.`
|
|
29
|
+
).else((u) => `Uri '${u}' includes '${route}'`);
|
|
30
|
+
expect.extend({
|
|
31
|
+
toMatchRoute
|
|
32
|
+
});
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
toMatchRoute
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=toMatchRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchRoute.ts"],"sourcesContent":["import { Uri } from '../utils/Types';\nimport { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchRoute = (uri?: Uri, route?: Uri | string): jest.CustomMatcherResult =>\n match<Uri | undefined>(uri)\n .undefined(u => u, 'Subject is undefined.')\n .undefined(() => route, 'Route to include is undefined.')\n .not(\n u => asString(u).includes(asString(route)),\n u => `Uri '${u}' does not include '${route}'.`\n )\n .else(u => `Uri '${u}' includes '${route}'`);\n\nexpect.extend({\n toMatchRoute: toMatchRoute,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchRoute(route?: Uri | string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsB;AACtB,mBAAyB;AAElB,MAAM,eAAe,CAAC,KAAW,cACtC,oBAAuB,GAAG,EACvB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,OAAO,gCAAgC,EACvD;AAAA,EACC,WAAK,uBAAS,CAAC,EAAE,aAAS,uBAAS,KAAK,CAAC;AAAA,EACzC,OAAK,QAAQ,CAAC,uBAAuB,KAAK;AAC5C,EACC,KAAK,OAAK,QAAQ,CAAC,eAAe,KAAK,GAAG;AAE/C,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { match } from "./Match";
|
|
2
|
+
import { asString } from "../utils/Utils";
|
|
3
|
+
const toMatchRoute = (uri, route) => match(uri).undefined((u) => u, "Subject is undefined.").undefined(() => route, "Route to include is undefined.").not(
|
|
4
|
+
(u) => asString(u).includes(asString(route)),
|
|
5
|
+
(u) => `Uri '${u}' does not include '${route}'.`
|
|
6
|
+
).else((u) => `Uri '${u}' includes '${route}'`);
|
|
7
|
+
expect.extend({
|
|
8
|
+
toMatchRoute
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
toMatchRoute
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=toMatchRoute.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchRoute.ts"],"sourcesContent":["import { Uri } from '../utils/Types';\nimport { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchRoute = (uri?: Uri, route?: Uri | string): jest.CustomMatcherResult =>\n match<Uri | undefined>(uri)\n .undefined(u => u, 'Subject is undefined.')\n .undefined(() => route, 'Route to include is undefined.')\n .not(\n u => asString(u).includes(asString(route)),\n u => `Uri '${u}' does not include '${route}'.`\n )\n .else(u => `Uri '${u}' includes '${route}'`);\n\nexpect.extend({\n toMatchRoute: toMatchRoute,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchRoute(route?: Uri | string): R;\n }\n }\n}\n"],"mappings":"AACA,SAAS,aAAa;AACtB,SAAS,gBAAgB;AAElB,MAAM,eAAe,CAAC,KAAW,UACtC,MAAuB,GAAG,EACvB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,OAAO,gCAAgC,EACvD;AAAA,EACC,OAAK,SAAS,CAAC,EAAE,SAAS,SAAS,KAAK,CAAC;AAAA,EACzC,OAAK,QAAQ,CAAC,uBAAuB,KAAK;AAC5C,EACC,KAAK,OAAK,QAAQ,CAAC,eAAe,KAAK,GAAG;AAE/C,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toMatchText_exports = {};
|
|
20
|
+
__export(toMatchText_exports, {
|
|
21
|
+
toMatchText: () => toMatchText
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(toMatchText_exports);
|
|
24
|
+
var import_Match = require("./Match");
|
|
25
|
+
var import_Utils = require("../utils/Utils");
|
|
26
|
+
const toMatchText = (value, text) => (0, import_Match.match)(value).undefined((v) => v, "Subject is undefined.").undefined(() => text, "Text to match with is undefined.").not(
|
|
27
|
+
(v) => (0, import_Utils.asString)(v) === (0, import_Utils.asString)(text),
|
|
28
|
+
(v) => `Text '${v}' does not match with text '${text}'.`
|
|
29
|
+
).else((v) => `Text '${v}' matches`);
|
|
30
|
+
expect.extend({
|
|
31
|
+
toMatchText
|
|
32
|
+
});
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
toMatchText
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=toMatchText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchText.ts"],"sourcesContent":["import { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchText = (value?: unknown, text?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, 'Subject is undefined.')\n .undefined(() => text, 'Text to match with is undefined.')\n .not(\n v => asString(v) === asString(text),\n v => `Text '${v}' does not match with text '${text}'.`\n )\n .else(v => `Text '${v}' matches`);\n\nexpect.extend({\n toMatchText: toMatchText,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchText(text?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,mBAAyB;AAElB,MAAM,cAAc,CAAC,OAAiB,aAC3C,oBAAe,KAAK,EACjB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,MAAM,kCAAkC,EACxD;AAAA,EACC,WAAK,uBAAS,CAAC,UAAM,uBAAS,IAAI;AAAA,EAClC,OAAK,SAAS,CAAC,+BAA+B,IAAI;AACpD,EACC,KAAK,OAAK,SAAS,CAAC,WAAW;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { match } from "./Match";
|
|
2
|
+
import { asString } from "../utils/Utils";
|
|
3
|
+
const toMatchText = (value, text) => match(value).undefined((v) => v, "Subject is undefined.").undefined(() => text, "Text to match with is undefined.").not(
|
|
4
|
+
(v) => asString(v) === asString(text),
|
|
5
|
+
(v) => `Text '${v}' does not match with text '${text}'.`
|
|
6
|
+
).else((v) => `Text '${v}' matches`);
|
|
7
|
+
expect.extend({
|
|
8
|
+
toMatchText
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
toMatchText
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=toMatchText.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toMatchText.ts"],"sourcesContent":["import { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchText = (value?: unknown, text?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, 'Subject is undefined.')\n .undefined(() => text, 'Text to match with is undefined.')\n .not(\n v => asString(v) === asString(text),\n v => `Text '${v}' does not match with text '${text}'.`\n )\n .else(v => `Text '${v}' matches`);\n\nexpect.extend({\n toMatchText: toMatchText,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchText(text?: unknown): R;\n }\n }\n}\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,gBAAgB;AAElB,MAAM,cAAc,CAAC,OAAiB,SAC3C,MAAe,KAAK,EACjB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,MAAM,kCAAkC,EACxD;AAAA,EACC,OAAK,SAAS,CAAC,MAAM,SAAS,IAAI;AAAA,EAClC,OAAK,SAAS,CAAC,+BAA+B,IAAI;AACpD,EACC,KAAK,OAAK,SAAS,CAAC,WAAW;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Message } from '../utils/Types';
|
|
2
|
+
export declare const Passes: {
|
|
3
|
+
Yes: string;
|
|
4
|
+
No: (reason: string) => string;
|
|
5
|
+
};
|
|
6
|
+
export declare const PassesWith: {
|
|
7
|
+
Yes: string;
|
|
8
|
+
No: (message: string, instead: string) => string;
|
|
9
|
+
};
|
|
10
|
+
export declare const toPassMatcher: (result: jest.CustomMatcherResult) => jest.CustomMatcherResult;
|
|
11
|
+
export declare const toPassMatcherWith: (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>) => jest.CustomMatcherResult;
|
|
12
|
+
declare global {
|
|
13
|
+
namespace jest {
|
|
14
|
+
interface Matchers<R, T> {
|
|
15
|
+
toPassMatcher(): R;
|
|
16
|
+
toPassMatcherWith(message: string): R;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toPassMatcher_exports = {};
|
|
20
|
+
__export(toPassMatcher_exports, {
|
|
21
|
+
Passes: () => Passes,
|
|
22
|
+
PassesWith: () => PassesWith,
|
|
23
|
+
toPassMatcher: () => toPassMatcher,
|
|
24
|
+
toPassMatcherWith: () => toPassMatcherWith
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(toPassMatcher_exports);
|
|
27
|
+
var import_Match = require("./Match");
|
|
28
|
+
var import_Types = require("../utils/Types");
|
|
29
|
+
const Passes = {
|
|
30
|
+
Yes: "Match passes, instead of fails.",
|
|
31
|
+
No: (reason) => `Match doesn't pass, because '${reason}'`
|
|
32
|
+
};
|
|
33
|
+
const PassesWith = {
|
|
34
|
+
Yes: "Match passes with correct message.",
|
|
35
|
+
No: (message, instead) => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`
|
|
36
|
+
};
|
|
37
|
+
const toPassMatcher = (result) => (0, import_Match.match)(result).not(
|
|
38
|
+
(c) => c.pass,
|
|
39
|
+
(c) => Passes.No(c.message())
|
|
40
|
+
).else(Passes.Yes);
|
|
41
|
+
const toPassMatcherWith = (result, message) => (0, import_Match.match)(result).not(
|
|
42
|
+
(c) => c.pass,
|
|
43
|
+
(c) => Passes.No(c.message())
|
|
44
|
+
).not(
|
|
45
|
+
(c) => c.message().includes((0, import_Types.toMessage)(message)),
|
|
46
|
+
(c) => PassesWith.No((0, import_Types.toMessage)(message), c.message())
|
|
47
|
+
).else(PassesWith.Yes);
|
|
48
|
+
expect.extend({
|
|
49
|
+
toPassMatcher,
|
|
50
|
+
toPassMatcherWith
|
|
51
|
+
});
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
Passes,
|
|
55
|
+
PassesWith,
|
|
56
|
+
toPassMatcher,
|
|
57
|
+
toPassMatcherWith
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=toPassMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toPassMatcher.ts"],"sourcesContent":["import { match } from './Match';\n\nimport { Message, toMessage } from '../utils/Types';\n\n// Handles CustomMatcherResult validations.\n\nexport const Passes = {\n Yes: 'Match passes, instead of fails.',\n No: (reason: string): string => `Match doesn't pass, because '${reason}'`,\n};\n\nexport const PassesWith = {\n Yes: 'Match passes with correct message.',\n No: (message: string, instead: string): string => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`,\n};\n\nexport const toPassMatcher = (result: jest.CustomMatcherResult): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => c.pass,\n c => Passes.No(c.message())\n )\n .else(Passes.Yes);\n\nexport const toPassMatcherWith = (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => c.pass,\n c => Passes.No(c.message())\n )\n .not(\n c => c.message().includes(toMessage(message)),\n c => PassesWith.No(toMessage(message), c.message())\n )\n .else(PassesWith.Yes);\n\nexpect.extend({\n toPassMatcher: toPassMatcher,\n toPassMatcherWith: toPassMatcherWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toPassMatcher(): R;\n toPassMatcherWith(message: string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AAEtB,mBAAmC;AAI5B,MAAM,SAAS;AAAA,EACpB,KAAK;AAAA,EACL,IAAI,CAAC,WAA2B,gCAAgC,MAAM;AACxE;AAEO,MAAM,aAAa;AAAA,EACxB,KAAK;AAAA,EACL,IAAI,CAAC,SAAiB,YAA4B,8CAA8C,OAAO,wBAAwB,OAAO;AACxI;AAEO,MAAM,gBAAgB,CAAC,eAC5B,oBAAM,MAAM,EACT;AAAA,EACC,OAAK,EAAE;AAAA,EACP,OAAK,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC5B,EACC,KAAK,OAAO,GAAG;AAEb,MAAM,oBAAoB,CAAC,QAAkC,gBAClE,oBAAM,MAAM,EACT;AAAA,EACC,OAAK,EAAE;AAAA,EACP,OAAK,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC5B,EACC;AAAA,EACC,OAAK,EAAE,QAAQ,EAAE,aAAS,wBAAU,OAAO,CAAC;AAAA,EAC5C,OAAK,WAAW,OAAG,wBAAU,OAAO,GAAG,EAAE,QAAQ,CAAC;AACpD,EACC,KAAK,WAAW,GAAG;AAExB,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { match } from "./Match";
|
|
2
|
+
import { toMessage } from "../utils/Types";
|
|
3
|
+
const Passes = {
|
|
4
|
+
Yes: "Match passes, instead of fails.",
|
|
5
|
+
No: (reason) => `Match doesn't pass, because '${reason}'`
|
|
6
|
+
};
|
|
7
|
+
const PassesWith = {
|
|
8
|
+
Yes: "Match passes with correct message.",
|
|
9
|
+
No: (message, instead) => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`
|
|
10
|
+
};
|
|
11
|
+
const toPassMatcher = (result) => match(result).not(
|
|
12
|
+
(c) => c.pass,
|
|
13
|
+
(c) => Passes.No(c.message())
|
|
14
|
+
).else(Passes.Yes);
|
|
15
|
+
const toPassMatcherWith = (result, message) => match(result).not(
|
|
16
|
+
(c) => c.pass,
|
|
17
|
+
(c) => Passes.No(c.message())
|
|
18
|
+
).not(
|
|
19
|
+
(c) => c.message().includes(toMessage(message)),
|
|
20
|
+
(c) => PassesWith.No(toMessage(message), c.message())
|
|
21
|
+
).else(PassesWith.Yes);
|
|
22
|
+
expect.extend({
|
|
23
|
+
toPassMatcher,
|
|
24
|
+
toPassMatcherWith
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
Passes,
|
|
28
|
+
PassesWith,
|
|
29
|
+
toPassMatcher,
|
|
30
|
+
toPassMatcherWith
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=toPassMatcher.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toPassMatcher.ts"],"sourcesContent":["import { match } from './Match';\n\nimport { Message, toMessage } from '../utils/Types';\n\n// Handles CustomMatcherResult validations.\n\nexport const Passes = {\n Yes: 'Match passes, instead of fails.',\n No: (reason: string): string => `Match doesn't pass, because '${reason}'`,\n};\n\nexport const PassesWith = {\n Yes: 'Match passes with correct message.',\n No: (message: string, instead: string): string => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`,\n};\n\nexport const toPassMatcher = (result: jest.CustomMatcherResult): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => c.pass,\n c => Passes.No(c.message())\n )\n .else(Passes.Yes);\n\nexport const toPassMatcherWith = (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => c.pass,\n c => Passes.No(c.message())\n )\n .not(\n c => c.message().includes(toMessage(message)),\n c => PassesWith.No(toMessage(message), c.message())\n )\n .else(PassesWith.Yes);\n\nexpect.extend({\n toPassMatcher: toPassMatcher,\n toPassMatcherWith: toPassMatcherWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toPassMatcher(): R;\n toPassMatcherWith(message: string): R;\n }\n }\n}\n"],"mappings":"AAAA,SAAS,aAAa;AAEtB,SAAkB,iBAAiB;AAI5B,MAAM,SAAS;AAAA,EACpB,KAAK;AAAA,EACL,IAAI,CAAC,WAA2B,gCAAgC,MAAM;AACxE;AAEO,MAAM,aAAa;AAAA,EACxB,KAAK;AAAA,EACL,IAAI,CAAC,SAAiB,YAA4B,8CAA8C,OAAO,wBAAwB,OAAO;AACxI;AAEO,MAAM,gBAAgB,CAAC,WAC5B,MAAM,MAAM,EACT;AAAA,EACC,OAAK,EAAE;AAAA,EACP,OAAK,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC5B,EACC,KAAK,OAAO,GAAG;AAEb,MAAM,oBAAoB,CAAC,QAAkC,YAClE,MAAM,MAAM,EACT;AAAA,EACC,OAAK,EAAE;AAAA,EACP,OAAK,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC5B,EACC;AAAA,EACC,OAAK,EAAE,QAAQ,EAAE,SAAS,UAAU,OAAO,CAAC;AAAA,EAC5C,OAAK,WAAW,GAAG,UAAU,OAAO,GAAG,EAAE,QAAQ,CAAC;AACpD,EACC,KAAK,WAAW,GAAG;AAExB,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AsymmetricMatcher } from 'expect';
|
|
2
|
+
import { Uri } from '../utils/Types';
|
|
3
|
+
export declare class ObjectContainingText extends AsymmetricMatcher<string> {
|
|
4
|
+
asymmetricMatch(other: any): boolean;
|
|
5
|
+
toString(): string;
|
|
6
|
+
}
|
|
7
|
+
export declare class ObjectContainingTextExact extends AsymmetricMatcher<string> {
|
|
8
|
+
asymmetricMatch(other: any): boolean;
|
|
9
|
+
toString(): string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ObjectContainingJson extends AsymmetricMatcher<any> {
|
|
12
|
+
asymmetricMatch(other: any): boolean;
|
|
13
|
+
toString(): string;
|
|
14
|
+
}
|
|
15
|
+
export declare const fits: {
|
|
16
|
+
any: () => any;
|
|
17
|
+
type: (type?: unknown) => any;
|
|
18
|
+
with: (o: unknown) => any;
|
|
19
|
+
text: (s: any) => any;
|
|
20
|
+
textExact: (s: any) => any;
|
|
21
|
+
uri: (u: Uri) => any;
|
|
22
|
+
json: (s: any) => any;
|
|
23
|
+
items: (...items: any[]) => any;
|
|
24
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var Fits_exports = {};
|
|
20
|
+
__export(Fits_exports, {
|
|
21
|
+
ObjectContainingJson: () => ObjectContainingJson,
|
|
22
|
+
ObjectContainingText: () => ObjectContainingText,
|
|
23
|
+
ObjectContainingTextExact: () => ObjectContainingTextExact,
|
|
24
|
+
fits: () => fits
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(Fits_exports);
|
|
27
|
+
var import_Utils = require("../utils/Utils");
|
|
28
|
+
var import_Eq = require("../utils/Eq");
|
|
29
|
+
var import_expect = require("expect");
|
|
30
|
+
class ObjectContainingText extends import_expect.AsymmetricMatcher {
|
|
31
|
+
asymmetricMatch(other) {
|
|
32
|
+
return (0, import_Utils.asString)(other).includes((0, import_Utils.asString)(this.sample));
|
|
33
|
+
}
|
|
34
|
+
toString() {
|
|
35
|
+
return `String${this.inverse ? "Not" : ""}Containing`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class ObjectContainingTextExact extends import_expect.AsymmetricMatcher {
|
|
39
|
+
asymmetricMatch(other) {
|
|
40
|
+
return (0, import_Utils.asString)(other) === (0, import_Utils.asString)(this.sample);
|
|
41
|
+
}
|
|
42
|
+
toString() {
|
|
43
|
+
return `String${this.inverse ? "Not" : ""}Containing`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class ObjectContainingJson extends import_expect.AsymmetricMatcher {
|
|
47
|
+
asymmetricMatch(other) {
|
|
48
|
+
return import_Eq.eq.subset((0, import_Utils.asJson)(other), (0, import_Utils.asJson)(this.sample));
|
|
49
|
+
}
|
|
50
|
+
toString() {
|
|
51
|
+
return `Object${this.inverse ? "Not" : ""}Containing`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const fits = {
|
|
55
|
+
any: () => expect.anything(),
|
|
56
|
+
type: (type) => expect.any(type),
|
|
57
|
+
with: (o) => expect.objectContaining(o),
|
|
58
|
+
text: (s) => new ObjectContainingText(s),
|
|
59
|
+
textExact: (s) => new ObjectContainingTextExact(s),
|
|
60
|
+
uri: (u) => fits.textExact(u),
|
|
61
|
+
json: (s) => new ObjectContainingJson(s),
|
|
62
|
+
items: (...items) => expect.arrayContaining((0, import_Utils.toArray)(...items))
|
|
63
|
+
};
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
ObjectContainingJson,
|
|
67
|
+
ObjectContainingText,
|
|
68
|
+
ObjectContainingTextExact,
|
|
69
|
+
fits
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=Fits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mock/Fits.ts"],"sourcesContent":["import { asJson, asString, toArray } from '../utils/Utils';\nimport { eq } from '../utils/Eq';\nimport { AsymmetricMatcher } from 'expect';\nimport { Uri } from '../utils/Types';\n\nexport class ObjectContainingText extends AsymmetricMatcher<string> {\n asymmetricMatch(other: any) {\n return asString(other).includes(asString(this.sample));\n }\n\n toString() {\n return `String${this.inverse ? 'Not' : ''}Containing`;\n }\n}\n\nexport class ObjectContainingTextExact extends AsymmetricMatcher<string> {\n asymmetricMatch(other: any) {\n return asString(other) === asString(this.sample);\n }\n\n toString() {\n return `String${this.inverse ? 'Not' : ''}Containing`;\n }\n}\n\nexport class ObjectContainingJson extends AsymmetricMatcher<any> {\n asymmetricMatch(other: any) {\n return eq.subset(asJson(other), asJson(this.sample));\n }\n\n toString() {\n return `Object${this.inverse ? 'Not' : ''}Containing`;\n }\n}\n\nexport const fits = {\n any: (): any => expect.anything(),\n type: (type?: unknown): any => expect.any(type),\n with: (o: unknown): any => expect.objectContaining(o),\n text: (s: any): any => new ObjectContainingText(s),\n textExact: (s: any): any => new ObjectContainingTextExact(s),\n uri: (u: Uri): any => fits.textExact(u),\n json: (s: any): any => new ObjectContainingJson(s),\n items: (...items: any[]): any => expect.arrayContaining(toArray(...items)),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAC1C,gBAAmB;AACnB,oBAAkC;AAG3B,MAAM,6BAA6B,gCAA0B;AAAA,EAClE,gBAAgB,OAAY;AAC1B,eAAO,uBAAS,KAAK,EAAE,aAAS,uBAAS,KAAK,MAAM,CAAC;AAAA,EACvD;AAAA,EAEA,WAAW;AACT,WAAO,SAAS,KAAK,UAAU,QAAQ,EAAE;AAAA,EAC3C;AACF;AAEO,MAAM,kCAAkC,gCAA0B;AAAA,EACvE,gBAAgB,OAAY;AAC1B,eAAO,uBAAS,KAAK,UAAM,uBAAS,KAAK,MAAM;AAAA,EACjD;AAAA,EAEA,WAAW;AACT,WAAO,SAAS,KAAK,UAAU,QAAQ,EAAE;AAAA,EAC3C;AACF;AAEO,MAAM,6BAA6B,gCAAuB;AAAA,EAC/D,gBAAgB,OAAY;AAC1B,WAAO,aAAG,WAAO,qBAAO,KAAK,OAAG,qBAAO,KAAK,MAAM,CAAC;AAAA,EACrD;AAAA,EAEA,WAAW;AACT,WAAO,SAAS,KAAK,UAAU,QAAQ,EAAE;AAAA,EAC3C;AACF;AAEO,MAAM,OAAO;AAAA,EAClB,KAAK,MAAW,OAAO,SAAS;AAAA,EAChC,MAAM,CAAC,SAAwB,OAAO,IAAI,IAAI;AAAA,EAC9C,MAAM,CAAC,MAAoB,OAAO,iBAAiB,CAAC;AAAA,EACpD,MAAM,CAAC,MAAgB,IAAI,qBAAqB,CAAC;AAAA,EACjD,WAAW,CAAC,MAAgB,IAAI,0BAA0B,CAAC;AAAA,EAC3D,KAAK,CAAC,MAAgB,KAAK,UAAU,CAAC;AAAA,EACtC,MAAM,CAAC,MAAgB,IAAI,qBAAqB,CAAC;AAAA,EACjD,OAAO,IAAI,UAAsB,OAAO,oBAAgB,sBAAQ,GAAG,KAAK,CAAC;AAC3E;","names":[]}
|