@thisisagile/easy-test 18.17.0 → 19.0.1
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/chunk-6FEQASGO.mjs +17 -0
- package/dist/chunk-6FEQASGO.mjs.map +1 -0
- package/dist/chunk-ART72TJA.mjs +25 -0
- package/dist/chunk-ART72TJA.mjs.map +1 -0
- package/dist/chunk-BN2IG45X.mjs +24 -0
- package/dist/chunk-BN2IG45X.mjs.map +1 -0
- package/dist/chunk-BZXBZCMZ.mjs +26 -0
- package/dist/chunk-BZXBZCMZ.mjs.map +1 -0
- package/dist/chunk-CQPHLHB7.mjs +86 -0
- package/dist/chunk-CQPHLHB7.mjs.map +1 -0
- package/dist/chunk-DHDFXV7G.mjs +53 -0
- package/dist/chunk-DHDFXV7G.mjs.map +1 -0
- package/dist/chunk-DMSYYRBM.mjs +59 -0
- package/dist/chunk-DMSYYRBM.mjs.map +1 -0
- package/dist/chunk-EZNTPFD2.mjs +39 -0
- package/dist/chunk-EZNTPFD2.mjs.map +1 -0
- package/dist/chunk-GRYVDJXU.mjs +1 -0
- package/dist/chunk-GRYVDJXU.mjs.map +1 -0
- package/dist/chunk-MBQSBGEE.mjs +1 -0
- package/dist/chunk-MBQSBGEE.mjs.map +1 -0
- package/dist/chunk-PPXFT3SX.mjs +14 -0
- package/dist/chunk-PPXFT3SX.mjs.map +1 -0
- package/dist/chunk-QWLALNJL.mjs +30 -0
- package/dist/chunk-QWLALNJL.mjs.map +1 -0
- package/dist/chunk-RPYWAKYZ.mjs +39 -0
- package/dist/chunk-RPYWAKYZ.mjs.map +1 -0
- package/dist/chunk-SGV4XPW3.mjs +27 -0
- package/dist/chunk-SGV4XPW3.mjs.map +1 -0
- package/dist/chunk-TUE23FNE.mjs +17 -0
- package/dist/chunk-TUE23FNE.mjs.map +1 -0
- package/dist/chunk-UFDXFCRK.mjs +19 -0
- package/dist/chunk-UFDXFCRK.mjs.map +1 -0
- package/dist/chunk-UOO6EMXQ.mjs +20 -0
- package/dist/chunk-UOO6EMXQ.mjs.map +1 -0
- package/dist/chunk-WAKTWLNU.mjs +32 -0
- package/dist/chunk-WAKTWLNU.mjs.map +1 -0
- package/dist/chunk-YL7PRCYP.mjs +26 -0
- package/dist/chunk-YL7PRCYP.mjs.map +1 -0
- package/dist/chunk-Z6NXMCUL.mjs +17 -0
- package/dist/chunk-Z6NXMCUL.mjs.map +1 -0
- package/dist/chunk-ZBSBLFC7.mjs +20 -0
- package/dist/chunk-ZBSBLFC7.mjs.map +1 -0
- package/dist/index.mjs +150 -2
- package/dist/index.mjs.map +1 -1
- package/dist/matchers/HttpMatchers.mjs +13 -41
- package/dist/matchers/HttpMatchers.mjs.map +1 -1
- package/dist/matchers/ResultMatchers.mjs +5 -22
- package/dist/matchers/ResultMatchers.mjs.map +1 -1
- package/dist/matchers/index.mjs +132 -19
- package/dist/matchers/index.mjs.map +1 -1
- package/dist/matchers/toBeArrayOf.mjs +3 -8
- package/dist/matchers/toBeArrayOf.mjs.map +1 -1
- package/dist/matchers/toBeArrayOfWithLength.mjs +3 -11
- package/dist/matchers/toBeArrayOfWithLength.mjs.map +1 -1
- package/dist/matchers/toBeAt.mjs +3 -19
- package/dist/matchers/toBeAt.mjs.map +1 -1
- package/dist/matchers/toBeExactlyAt.mjs +4 -20
- package/dist/matchers/toBeExactlyAt.mjs.map +1 -1
- package/dist/matchers/toBeQueriedWith.mjs +3 -11
- package/dist/matchers/toBeQueriedWith.mjs.map +1 -1
- package/dist/matchers/toBeRoutedTo.mjs +7 -24
- package/dist/matchers/toBeRoutedTo.mjs.map +1 -1
- package/dist/matchers/toBeValid.mjs +4 -11
- package/dist/matchers/toBeValid.mjs.map +1 -1
- package/dist/matchers/toFailMatcher.mjs +6 -29
- package/dist/matchers/toFailMatcher.mjs.map +1 -1
- package/dist/matchers/toMatchArray.mjs +3 -13
- package/dist/matchers/toMatchArray.mjs.map +1 -1
- package/dist/matchers/toMatchExactJson.mjs +5 -17
- package/dist/matchers/toMatchExactJson.mjs.map +1 -1
- package/dist/matchers/toMatchException.mjs +4 -20
- package/dist/matchers/toMatchException.mjs.map +1 -1
- package/dist/matchers/toMatchJson.mjs +6 -20
- package/dist/matchers/toMatchJson.mjs.map +1 -1
- package/dist/matchers/toMatchRoute.mjs +4 -14
- package/dist/matchers/toMatchRoute.mjs.map +1 -1
- package/dist/matchers/toMatchText.mjs +4 -14
- package/dist/matchers/toMatchText.mjs.map +1 -1
- package/dist/matchers/toPassMatcher.mjs +6 -29
- package/dist/matchers/toPassMatcher.mjs.map +1 -1
- package/dist/mock/Fits.mjs +7 -44
- package/dist/mock/Fits.mjs.map +1 -1
- package/dist/mock/Mocks.mjs +4 -79
- package/dist/mock/Mocks.mjs.map +1 -1
- package/dist/mock/index.mjs +22 -2
- package/dist/mock/index.mjs.map +1 -1
- package/package.json +125 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkDefined
|
|
3
|
+
} from "./chunk-Z4XAP66Q.mjs";
|
|
4
|
+
import {
|
|
5
|
+
match
|
|
6
|
+
} from "./chunk-LN24S2PC.mjs";
|
|
7
|
+
import {
|
|
8
|
+
asString
|
|
9
|
+
} from "./chunk-O475TEG2.mjs";
|
|
10
|
+
|
|
11
|
+
// src/matchers/toBeRoutedTo.ts
|
|
12
|
+
var weExpectedButReceivedInstead = ([r, e]) => `We expected ${asString(e)}, but we received '${asString(r)}' instead.`;
|
|
13
|
+
function toMatchAsString(received, expected) {
|
|
14
|
+
return checkDefined(this, received, expected).not(
|
|
15
|
+
([r, e]) => this.equals(asString(r), asString(e)),
|
|
16
|
+
([r, e]) => weExpectedButReceivedInstead([r, e])
|
|
17
|
+
).else();
|
|
18
|
+
}
|
|
19
|
+
var toBeRoutedTo = (query, expected) => match(query?.mock?.calls).undefined((c) => c, "Uri is unknown.").not((c) => c.length === 1, "Method was not called.").not(
|
|
20
|
+
(c) => asString(c[0][0]) === asString(expected),
|
|
21
|
+
(c) => `We expected uri '${asString(expected)}', but we received uri '${asString(c[0][0])}' instead.`
|
|
22
|
+
).else(`Called uri does match '${asString(expected)}'`);
|
|
23
|
+
expect.extend({
|
|
24
|
+
toBeRoutedTo
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
weExpectedButReceivedInstead,
|
|
29
|
+
toMatchAsString,
|
|
30
|
+
toBeRoutedTo
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=chunk-WAKTWLNU.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/matchers/toBeRoutedTo.ts"],"sourcesContent":["import { checkDefined } from './Check';\nimport { Uri } from '../utils/Types';\nimport { asString } from '../utils/Utils';\nimport { match } from './Match';\n\nexport const weExpectedButReceivedInstead = ([r, e]: [any, any]) => `We expected ${asString(e)}, but we received '${asString(r)}' instead.`;\n\nexport function toMatchAsString(this: jest.MatcherContext, received: unknown, expected: unknown): jest.CustomMatcherResult {\n return checkDefined(this, received, expected)\n .not(\n ([r, e]) => this.equals(asString(r), asString(e)),\n ([r, e]) => weExpectedButReceivedInstead([r, e])\n )\n .else();\n}\n\n// export function toBeRoutedTo(this: jest.MatcherContext, query: jest.Mock, expected: Uri): jest.CustomMatcherResult {\n// return check<any[]>(this, query?.mock?.calls)\n// .undefined(r => r, \"Uri is unknown.\")\n// .not(r => r.length === 1, \"Method was not called.\")\n// .not(r => this.equals(asString(r[0][0]), asString(expected)), ([r,e]) => weExpectedButReceivedInstead([r[0][0], e]))\n// .else();\n// }\n\nexport const toBeRoutedTo = (query: jest.Mock, expected: Uri): jest.CustomMatcherResult =>\n match<any[]>(query?.mock?.calls)\n .undefined(c => c, 'Uri is unknown.')\n .not(c => c.length === 1, 'Method was not called.')\n .not(\n c => asString(c[0][0]) === asString(expected),\n c => `We expected uri '${asString(expected)}', but we received uri '${asString(c[0][0])}' instead.`\n )\n .else(`Called uri does match '${asString(expected)}'`);\n\nexpect.extend({\n toBeRoutedTo: toBeRoutedTo,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeRoutedTo(uri: Uri): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAKO,IAAM,+BAA+B,CAAC,CAAC,GAAG,CAAC,MAAkB,eAAe,SAAS,CAAC,CAAC,sBAAsB,SAAS,CAAC,CAAC;AAExH,SAAS,gBAA2C,UAAmB,UAA6C;AACzH,SAAO,aAAa,MAAM,UAAU,QAAQ,EACzC;AAAA,IACC,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,OAAO,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;AAAA,IAChD,CAAC,CAAC,GAAG,CAAC,MAAM,6BAA6B,CAAC,GAAG,CAAC,CAAC;AAAA,EACjD,EACC,KAAK;AACV;AAUO,IAAM,eAAe,CAAC,OAAkB,aAC7C,MAAa,OAAO,MAAM,KAAK,EAC5B,UAAU,OAAK,GAAG,iBAAiB,EACnC,IAAI,OAAK,EAAE,WAAW,GAAG,wBAAwB,EACjD;AAAA,EACC,OAAK,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,SAAS,QAAQ;AAAA,EAC5C,OAAK,oBAAoB,SAAS,QAAQ,CAAC,2BAA2B,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzF,EACC,KAAK,0BAA0B,SAAS,QAAQ,CAAC,GAAG;AAEzD,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
match
|
|
3
|
+
} from "./chunk-LN24S2PC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
isDefined
|
|
6
|
+
} from "./chunk-O475TEG2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/matchers/toMatchException.ts
|
|
9
|
+
var toMatchException = (received, expected, reason) => match(expected).undefined((e) => e.id, "Expected value is not an exception.").not(
|
|
10
|
+
(e) => e.id === received.id,
|
|
11
|
+
(e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`
|
|
12
|
+
).not(
|
|
13
|
+
() => !isDefined(reason) || isDefined(reason) && isDefined(received.reason),
|
|
14
|
+
() => `We expected to have reason '${reason}', but we received no reason.`
|
|
15
|
+
).not(
|
|
16
|
+
() => !isDefined(reason) || isDefined(reason) && received.reason === reason,
|
|
17
|
+
() => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`
|
|
18
|
+
).else(`Expected exception matches received exception`);
|
|
19
|
+
expect.extend({
|
|
20
|
+
toMatchException
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
toMatchException
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=chunk-YL7PRCYP.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":";;;;;;;;AAIO,IAAM,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,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
match
|
|
3
|
+
} from "./chunk-LN24S2PC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/matchers/toBeArrayOfWithLength.ts
|
|
6
|
+
var toBeArrayOfWithLength = (items, ctor, length) => match(items).undefined((it) => it, "Subject is undefined.").not((it) => it instanceof Array, "Subject is not an array.").not(
|
|
7
|
+
(it) => it.length === length,
|
|
8
|
+
(it) => `Subject does not have ${length} elements, but ${it.length}.`
|
|
9
|
+
).not((it) => it.every((i) => i instanceof ctor), `Not all elements are of type '${ctor.name}'.`).else(`Subject has ${length} elements, which are all of type '${ctor.name}'`);
|
|
10
|
+
expect.extend({
|
|
11
|
+
toBeArrayOfWithLength
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
toBeArrayOfWithLength
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-Z6NXMCUL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/matchers/toBeArrayOfWithLength.ts"],"sourcesContent":["import { Constructor as Ctor } from '../utils/Types';\nimport { match } from './Match';\n\nexport const toBeArrayOfWithLength = <T>(items: unknown, ctor: Ctor<T>, length: number): jest.CustomMatcherResult =>\n match<unknown>(items)\n .undefined(it => it, 'Subject is undefined.')\n .not(it => it instanceof Array, 'Subject is not an array.')\n .not(\n it => (it as []).length === length,\n it => `Subject does not have ${length} elements, but ${(it as []).length}.`\n )\n .not(it => (it as []).every((i: any) => i instanceof ctor), `Not all elements are of type '${ctor.name}'.`)\n .else(`Subject has ${length} elements, which are all of type '${ctor.name}'`);\n\nexpect.extend({\n toBeArrayOfWithLength,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeArrayOfWithLength<Z>(ctor: Ctor<Z>, length: number): R;\n }\n }\n}\n"],"mappings":";;;;;AAGO,IAAM,wBAAwB,CAAI,OAAgB,MAAe,WACtE,MAAe,KAAK,EACjB,UAAU,QAAM,IAAI,uBAAuB,EAC3C,IAAI,QAAM,cAAc,OAAO,0BAA0B,EACzD;AAAA,EACC,QAAO,GAAU,WAAW;AAAA,EAC5B,QAAM,yBAAyB,MAAM,kBAAmB,GAAU,MAAM;AAC1E,EACC,IAAI,QAAO,GAAU,MAAM,CAAC,MAAW,aAAa,IAAI,GAAG,iCAAiC,KAAK,IAAI,IAAI,EACzG,KAAK,eAAe,MAAM,qCAAqC,KAAK,IAAI,GAAG;AAEhF,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
match
|
|
3
|
+
} from "./chunk-LN24S2PC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
asString
|
|
6
|
+
} from "./chunk-O475TEG2.mjs";
|
|
7
|
+
|
|
8
|
+
// src/matchers/toMatchRoute.ts
|
|
9
|
+
var toMatchRoute = (uri, route) => match(uri).undefined((u) => u, "Subject is undefined.").undefined(() => route, "Route to include is undefined.").not(
|
|
10
|
+
(u) => asString(u).includes(asString(route)),
|
|
11
|
+
(u) => `Uri '${u}' does not include '${route}'.`
|
|
12
|
+
).else((u) => `Uri '${u}' includes '${route}'`);
|
|
13
|
+
expect.extend({
|
|
14
|
+
toMatchRoute
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
toMatchRoute
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-ZBSBLFC7.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":";;;;;;;;AAIO,IAAM,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":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,151 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import "./chunk-MBQSBGEE.mjs";
|
|
2
|
+
import {
|
|
3
|
+
ObjectContainingJson,
|
|
4
|
+
ObjectContainingText,
|
|
5
|
+
ObjectContainingTextExact,
|
|
6
|
+
fits
|
|
7
|
+
} from "./chunk-DHDFXV7G.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Mocks,
|
|
10
|
+
mock
|
|
11
|
+
} from "./chunk-CQPHLHB7.mjs";
|
|
12
|
+
import "./chunk-SJR3TRWF.mjs";
|
|
13
|
+
import "./chunk-GRYVDJXU.mjs";
|
|
14
|
+
import {
|
|
15
|
+
toMatchException
|
|
16
|
+
} from "./chunk-YL7PRCYP.mjs";
|
|
17
|
+
import {
|
|
18
|
+
MatchesJson,
|
|
19
|
+
toMatchJson
|
|
20
|
+
} from "./chunk-SGV4XPW3.mjs";
|
|
21
|
+
import {
|
|
22
|
+
toMatchRoute
|
|
23
|
+
} from "./chunk-ZBSBLFC7.mjs";
|
|
24
|
+
import {
|
|
25
|
+
toMatchText
|
|
26
|
+
} from "./chunk-UOO6EMXQ.mjs";
|
|
27
|
+
import {
|
|
28
|
+
Passes,
|
|
29
|
+
PassesWith,
|
|
30
|
+
toPassMatcher,
|
|
31
|
+
toPassMatcherWith
|
|
32
|
+
} from "./chunk-RPYWAKYZ.mjs";
|
|
33
|
+
import {
|
|
34
|
+
toBeAt
|
|
35
|
+
} from "./chunk-ART72TJA.mjs";
|
|
36
|
+
import {
|
|
37
|
+
toBeExactlyAt
|
|
38
|
+
} from "./chunk-BZXBZCMZ.mjs";
|
|
39
|
+
import {
|
|
40
|
+
toBeQueriedWith
|
|
41
|
+
} from "./chunk-TUE23FNE.mjs";
|
|
42
|
+
import {
|
|
43
|
+
toBeRoutedTo,
|
|
44
|
+
toMatchAsString,
|
|
45
|
+
weExpectedButReceivedInstead
|
|
46
|
+
} from "./chunk-WAKTWLNU.mjs";
|
|
47
|
+
import {
|
|
48
|
+
toBeValid
|
|
49
|
+
} from "./chunk-6FEQASGO.mjs";
|
|
50
|
+
import {
|
|
51
|
+
Fails,
|
|
52
|
+
FailsWith,
|
|
53
|
+
toFailMatcher,
|
|
54
|
+
toFailMatcherWith
|
|
55
|
+
} from "./chunk-EZNTPFD2.mjs";
|
|
56
|
+
import {
|
|
57
|
+
toMatchArray
|
|
58
|
+
} from "./chunk-UFDXFCRK.mjs";
|
|
59
|
+
import {
|
|
60
|
+
MatchesExactJson,
|
|
61
|
+
toMatchExactJson
|
|
62
|
+
} from "./chunk-BN2IG45X.mjs";
|
|
63
|
+
import "./chunk-QE3TR4BY.mjs";
|
|
64
|
+
import {
|
|
65
|
+
check,
|
|
66
|
+
checkDefined
|
|
67
|
+
} from "./chunk-Z4XAP66Q.mjs";
|
|
68
|
+
import {
|
|
69
|
+
toBeBadGateway,
|
|
70
|
+
toBeBadRequest,
|
|
71
|
+
toBeConflict,
|
|
72
|
+
toBeCreated,
|
|
73
|
+
toBeForbidden,
|
|
74
|
+
toBeInternalServerError,
|
|
75
|
+
toBeNotFound,
|
|
76
|
+
toBeOk,
|
|
77
|
+
toBeOkWithItems,
|
|
78
|
+
toBeUnauthorized,
|
|
79
|
+
toHaveNoContent,
|
|
80
|
+
toHaveStatus
|
|
81
|
+
} from "./chunk-DMSYYRBM.mjs";
|
|
82
|
+
import {
|
|
83
|
+
toFail,
|
|
84
|
+
toFailWith,
|
|
85
|
+
toResultWith
|
|
86
|
+
} from "./chunk-QWLALNJL.mjs";
|
|
87
|
+
import {
|
|
88
|
+
toBeArrayOf
|
|
89
|
+
} from "./chunk-PPXFT3SX.mjs";
|
|
90
|
+
import {
|
|
91
|
+
toBeArrayOfWithLength
|
|
92
|
+
} from "./chunk-Z6NXMCUL.mjs";
|
|
93
|
+
import {
|
|
94
|
+
Match,
|
|
95
|
+
match
|
|
96
|
+
} from "./chunk-LN24S2PC.mjs";
|
|
97
|
+
import "./chunk-6EKWTLNQ.mjs";
|
|
98
|
+
import "./chunk-O475TEG2.mjs";
|
|
99
|
+
export {
|
|
100
|
+
Fails,
|
|
101
|
+
FailsWith,
|
|
102
|
+
Match,
|
|
103
|
+
MatchesExactJson,
|
|
104
|
+
MatchesJson,
|
|
105
|
+
Mocks,
|
|
106
|
+
ObjectContainingJson,
|
|
107
|
+
ObjectContainingText,
|
|
108
|
+
ObjectContainingTextExact,
|
|
109
|
+
Passes,
|
|
110
|
+
PassesWith,
|
|
111
|
+
check,
|
|
112
|
+
checkDefined,
|
|
113
|
+
fits,
|
|
114
|
+
match,
|
|
115
|
+
mock,
|
|
116
|
+
toBeArrayOf,
|
|
117
|
+
toBeArrayOfWithLength,
|
|
118
|
+
toBeAt,
|
|
119
|
+
toBeBadGateway,
|
|
120
|
+
toBeBadRequest,
|
|
121
|
+
toBeConflict,
|
|
122
|
+
toBeCreated,
|
|
123
|
+
toBeExactlyAt,
|
|
124
|
+
toBeForbidden,
|
|
125
|
+
toBeInternalServerError,
|
|
126
|
+
toBeNotFound,
|
|
127
|
+
toBeOk,
|
|
128
|
+
toBeOkWithItems,
|
|
129
|
+
toBeQueriedWith,
|
|
130
|
+
toBeRoutedTo,
|
|
131
|
+
toBeUnauthorized,
|
|
132
|
+
toBeValid,
|
|
133
|
+
toFail,
|
|
134
|
+
toFailMatcher,
|
|
135
|
+
toFailMatcherWith,
|
|
136
|
+
toFailWith,
|
|
137
|
+
toHaveNoContent,
|
|
138
|
+
toHaveStatus,
|
|
139
|
+
toMatchArray,
|
|
140
|
+
toMatchAsString,
|
|
141
|
+
toMatchExactJson,
|
|
142
|
+
toMatchException,
|
|
143
|
+
toMatchJson,
|
|
144
|
+
toMatchRoute,
|
|
145
|
+
toMatchText,
|
|
146
|
+
toPassMatcher,
|
|
147
|
+
toPassMatcherWith,
|
|
148
|
+
toResultWith,
|
|
149
|
+
weExpectedButReceivedInstead
|
|
150
|
+
};
|
|
3
151
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,48 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-LN24S2PC.mjs";
|
|
4
|
-
import "../chunk-6EKWTLNQ.mjs";
|
|
5
|
-
import "../chunk-O475TEG2.mjs";
|
|
6
|
-
|
|
7
|
-
// src/matchers/HttpMatchers.ts
|
|
8
|
-
var toHaveStatus = (res, code) => match(res).undefined((r) => r, "Response is unknown.").undefined(
|
|
9
|
-
(r) => r?.status?.id,
|
|
10
|
-
() => "Response does not have a status code"
|
|
11
|
-
).not(
|
|
12
|
-
(r) => r.status.id === code,
|
|
13
|
-
(r) => `Response does not have code '${code}', but has code '${r.status.id}' instead.`
|
|
14
|
-
).else(`Response does have status code '${code}'.`);
|
|
15
|
-
var toBeOk = (res) => toHaveStatus(res, 200);
|
|
16
|
-
var toBeCreated = (res) => toHaveStatus(res, 201);
|
|
17
|
-
var toHaveNoContent = (res) => toHaveStatus(res, 204);
|
|
18
|
-
var toBeBadRequest = (res) => toHaveStatus(res, 400);
|
|
19
|
-
var toBeUnauthorized = (res) => toHaveStatus(res, 401);
|
|
20
|
-
var toBeForbidden = (res) => toHaveStatus(res, 403);
|
|
21
|
-
var toBeNotFound = (res) => toHaveStatus(res, 404);
|
|
22
|
-
var toBeConflict = (res) => toHaveStatus(res, 409);
|
|
23
|
-
var toBeInternalServerError = (res) => toHaveStatus(res, 500);
|
|
24
|
-
var toBeBadGateway = (res) => toHaveStatus(res, 502);
|
|
25
|
-
var toBeOkWithItems = (res, length) => match(res).undefined((r) => r.status?.id, "Response did not have a status").not(
|
|
26
|
-
(r) => r.status.id === 200,
|
|
27
|
-
(r) => `Response did not have status '200'. It had status '${r.status.id}' instead.`
|
|
28
|
-
).undefined((r) => r?.body?.data?.items, `Response did not have any items.`).not(
|
|
29
|
-
(r) => (r?.body?.data?.itemCount ?? 0) >= length,
|
|
30
|
-
(r) => `Response did not have at least ${length} items. It only had ${r?.body?.data?.itemCount ?? 0} items.`
|
|
31
|
-
).else(`Response had status 200 and at least ${length} items`);
|
|
32
|
-
expect.extend({
|
|
33
|
-
toBeOk,
|
|
34
|
-
toBeOkWithItems,
|
|
35
|
-
toBeCreated,
|
|
36
|
-
toHaveNoContent,
|
|
37
|
-
toBeNotFound,
|
|
2
|
+
toBeBadGateway,
|
|
38
3
|
toBeBadRequest,
|
|
39
|
-
toBeUnauthorized,
|
|
40
|
-
toBeForbidden,
|
|
41
4
|
toBeConflict,
|
|
5
|
+
toBeCreated,
|
|
6
|
+
toBeForbidden,
|
|
42
7
|
toBeInternalServerError,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
8
|
+
toBeNotFound,
|
|
9
|
+
toBeOk,
|
|
10
|
+
toBeOkWithItems,
|
|
11
|
+
toBeUnauthorized,
|
|
12
|
+
toHaveNoContent,
|
|
13
|
+
toHaveStatus
|
|
14
|
+
} from "../chunk-DMSYYRBM.mjs";
|
|
15
|
+
import "../chunk-LN24S2PC.mjs";
|
|
16
|
+
import "../chunk-6EKWTLNQ.mjs";
|
|
17
|
+
import "../chunk-O475TEG2.mjs";
|
|
46
18
|
export {
|
|
47
19
|
toBeBadGateway,
|
|
48
20
|
toBeBadRequest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
toFail,
|
|
3
|
+
toFailWith,
|
|
4
|
+
toResultWith
|
|
5
|
+
} from "../chunk-QWLALNJL.mjs";
|
|
6
|
+
import "../chunk-LN24S2PC.mjs";
|
|
4
7
|
import "../chunk-6EKWTLNQ.mjs";
|
|
5
8
|
import "../chunk-O475TEG2.mjs";
|
|
6
|
-
|
|
7
|
-
// src/matchers/ResultMatchers.ts
|
|
8
|
-
var notDefined = "Results is not defined.";
|
|
9
|
-
var doesNotFail = "Results does not fail.";
|
|
10
|
-
var hasMessage = (res, message) => res.results.some((r) => r.message === message);
|
|
11
|
-
var messages = (res) => "'" + res?.results.map((r) => r.message).join("', '") + "'";
|
|
12
|
-
var toResultWith = (results, message) => match(results).undefined((r) => r, notDefined).not(
|
|
13
|
-
(r) => hasMessage(r, message),
|
|
14
|
-
(r) => `Results does not have message '${message}', but it has messages ${messages(r)} instead.`
|
|
15
|
-
).else(`Succeeds with message ${message}`);
|
|
16
|
-
var toFail = (results) => match(results).undefined((r) => r, notDefined).not((r) => !r.isValid, doesNotFail).else("Results does not fail");
|
|
17
|
-
var toFailWith = (results, message) => match(results).undefined((r) => r, notDefined).not((r) => !r.isValid, doesNotFail).not(
|
|
18
|
-
(r) => hasMessage(r, message),
|
|
19
|
-
(r) => `Fails, but results does not have message '${message}', but it has messages ${messages(r)} instead.`
|
|
20
|
-
).else(`Fails with message '${message}'`);
|
|
21
|
-
expect.extend({
|
|
22
|
-
toResultWith,
|
|
23
|
-
toFail,
|
|
24
|
-
toFailWith
|
|
25
|
-
});
|
|
26
9
|
export {
|
|
27
10
|
toFail,
|
|
28
11
|
toFailWith,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/matchers/index.mjs
CHANGED
|
@@ -1,20 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import "../chunk-GRYVDJXU.mjs";
|
|
2
|
+
import {
|
|
3
|
+
toMatchException
|
|
4
|
+
} from "../chunk-YL7PRCYP.mjs";
|
|
5
|
+
import {
|
|
6
|
+
MatchesJson,
|
|
7
|
+
toMatchJson
|
|
8
|
+
} from "../chunk-SGV4XPW3.mjs";
|
|
9
|
+
import {
|
|
10
|
+
toMatchRoute
|
|
11
|
+
} from "../chunk-ZBSBLFC7.mjs";
|
|
12
|
+
import {
|
|
13
|
+
toMatchText
|
|
14
|
+
} from "../chunk-UOO6EMXQ.mjs";
|
|
15
|
+
import {
|
|
16
|
+
Passes,
|
|
17
|
+
PassesWith,
|
|
18
|
+
toPassMatcher,
|
|
19
|
+
toPassMatcherWith
|
|
20
|
+
} from "../chunk-RPYWAKYZ.mjs";
|
|
21
|
+
import {
|
|
22
|
+
toBeAt
|
|
23
|
+
} from "../chunk-ART72TJA.mjs";
|
|
24
|
+
import {
|
|
25
|
+
toBeExactlyAt
|
|
26
|
+
} from "../chunk-BZXBZCMZ.mjs";
|
|
27
|
+
import {
|
|
28
|
+
toBeQueriedWith
|
|
29
|
+
} from "../chunk-TUE23FNE.mjs";
|
|
30
|
+
import {
|
|
31
|
+
toBeRoutedTo,
|
|
32
|
+
toMatchAsString,
|
|
33
|
+
weExpectedButReceivedInstead
|
|
34
|
+
} from "../chunk-WAKTWLNU.mjs";
|
|
35
|
+
import {
|
|
36
|
+
toBeValid
|
|
37
|
+
} from "../chunk-6FEQASGO.mjs";
|
|
38
|
+
import {
|
|
39
|
+
Fails,
|
|
40
|
+
FailsWith,
|
|
41
|
+
toFailMatcher,
|
|
42
|
+
toFailMatcherWith
|
|
43
|
+
} from "../chunk-EZNTPFD2.mjs";
|
|
44
|
+
import {
|
|
45
|
+
toMatchArray
|
|
46
|
+
} from "../chunk-UFDXFCRK.mjs";
|
|
47
|
+
import {
|
|
48
|
+
MatchesExactJson,
|
|
49
|
+
toMatchExactJson
|
|
50
|
+
} from "../chunk-BN2IG45X.mjs";
|
|
51
|
+
import "../chunk-QE3TR4BY.mjs";
|
|
52
|
+
import {
|
|
53
|
+
check,
|
|
54
|
+
checkDefined
|
|
55
|
+
} from "../chunk-Z4XAP66Q.mjs";
|
|
56
|
+
import {
|
|
57
|
+
toBeBadGateway,
|
|
58
|
+
toBeBadRequest,
|
|
59
|
+
toBeConflict,
|
|
60
|
+
toBeCreated,
|
|
61
|
+
toBeForbidden,
|
|
62
|
+
toBeInternalServerError,
|
|
63
|
+
toBeNotFound,
|
|
64
|
+
toBeOk,
|
|
65
|
+
toBeOkWithItems,
|
|
66
|
+
toBeUnauthorized,
|
|
67
|
+
toHaveNoContent,
|
|
68
|
+
toHaveStatus
|
|
69
|
+
} from "../chunk-DMSYYRBM.mjs";
|
|
70
|
+
import {
|
|
71
|
+
toFail,
|
|
72
|
+
toFailWith,
|
|
73
|
+
toResultWith
|
|
74
|
+
} from "../chunk-QWLALNJL.mjs";
|
|
75
|
+
import {
|
|
76
|
+
toBeArrayOf
|
|
77
|
+
} from "../chunk-PPXFT3SX.mjs";
|
|
78
|
+
import {
|
|
79
|
+
toBeArrayOfWithLength
|
|
80
|
+
} from "../chunk-Z6NXMCUL.mjs";
|
|
81
|
+
import {
|
|
82
|
+
Match,
|
|
83
|
+
match
|
|
84
|
+
} from "../chunk-LN24S2PC.mjs";
|
|
85
|
+
import "../chunk-6EKWTLNQ.mjs";
|
|
86
|
+
import "../chunk-O475TEG2.mjs";
|
|
87
|
+
export {
|
|
88
|
+
Fails,
|
|
89
|
+
FailsWith,
|
|
90
|
+
Match,
|
|
91
|
+
MatchesExactJson,
|
|
92
|
+
MatchesJson,
|
|
93
|
+
Passes,
|
|
94
|
+
PassesWith,
|
|
95
|
+
check,
|
|
96
|
+
checkDefined,
|
|
97
|
+
match,
|
|
98
|
+
toBeArrayOf,
|
|
99
|
+
toBeArrayOfWithLength,
|
|
100
|
+
toBeAt,
|
|
101
|
+
toBeBadGateway,
|
|
102
|
+
toBeBadRequest,
|
|
103
|
+
toBeConflict,
|
|
104
|
+
toBeCreated,
|
|
105
|
+
toBeExactlyAt,
|
|
106
|
+
toBeForbidden,
|
|
107
|
+
toBeInternalServerError,
|
|
108
|
+
toBeNotFound,
|
|
109
|
+
toBeOk,
|
|
110
|
+
toBeOkWithItems,
|
|
111
|
+
toBeQueriedWith,
|
|
112
|
+
toBeRoutedTo,
|
|
113
|
+
toBeUnauthorized,
|
|
114
|
+
toBeValid,
|
|
115
|
+
toFail,
|
|
116
|
+
toFailMatcher,
|
|
117
|
+
toFailMatcherWith,
|
|
118
|
+
toFailWith,
|
|
119
|
+
toHaveNoContent,
|
|
120
|
+
toHaveStatus,
|
|
121
|
+
toMatchArray,
|
|
122
|
+
toMatchAsString,
|
|
123
|
+
toMatchExactJson,
|
|
124
|
+
toMatchException,
|
|
125
|
+
toMatchJson,
|
|
126
|
+
toMatchRoute,
|
|
127
|
+
toMatchText,
|
|
128
|
+
toPassMatcher,
|
|
129
|
+
toPassMatcherWith,
|
|
130
|
+
toResultWith,
|
|
131
|
+
weExpectedButReceivedInstead
|
|
132
|
+
};
|
|
20
133
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
toBeArrayOf
|
|
3
|
+
} from "../chunk-PPXFT3SX.mjs";
|
|
4
|
+
import "../chunk-LN24S2PC.mjs";
|
|
4
5
|
import "../chunk-6EKWTLNQ.mjs";
|
|
5
6
|
import "../chunk-O475TEG2.mjs";
|
|
6
|
-
|
|
7
|
-
// src/matchers/toBeArrayOf.ts
|
|
8
|
-
var toBeArrayOf = (items, ctor) => match(items).undefined((it) => it, "Subject is undefined.").not((it) => it instanceof Array, "Subject is not an array.").not((it) => it.every((i) => i instanceof ctor), `Not all elements are of type '${ctor.name}'.`).else(`All elements in array are of type '${ctor.name}'`);
|
|
9
|
-
expect.extend({
|
|
10
|
-
toBeArrayOf
|
|
11
|
-
});
|
|
12
7
|
export {
|
|
13
8
|
toBeArrayOf
|
|
14
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
toBeArrayOfWithLength
|
|
3
|
+
} from "../chunk-Z6NXMCUL.mjs";
|
|
4
|
+
import "../chunk-LN24S2PC.mjs";
|
|
4
5
|
import "../chunk-6EKWTLNQ.mjs";
|
|
5
6
|
import "../chunk-O475TEG2.mjs";
|
|
6
|
-
|
|
7
|
-
// src/matchers/toBeArrayOfWithLength.ts
|
|
8
|
-
var toBeArrayOfWithLength = (items, ctor, length) => match(items).undefined((it) => it, "Subject is undefined.").not((it) => it instanceof Array, "Subject is not an array.").not(
|
|
9
|
-
(it) => it.length === length,
|
|
10
|
-
(it) => `Subject does not have ${length} elements, but ${it.length}.`
|
|
11
|
-
).not((it) => it.every((i) => i instanceof ctor), `Not all elements are of type '${ctor.name}'.`).else(`Subject has ${length} elements, which are all of type '${ctor.name}'`);
|
|
12
|
-
expect.extend({
|
|
13
|
-
toBeArrayOfWithLength
|
|
14
|
-
});
|
|
15
7
|
export {
|
|
16
8
|
toBeArrayOfWithLength
|
|
17
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/matchers/toBeAt.mjs
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
2
|
+
toBeAt
|
|
3
|
+
} from "../chunk-ART72TJA.mjs";
|
|
4
|
+
import "../chunk-LN24S2PC.mjs";
|
|
4
5
|
import "../chunk-6EKWTLNQ.mjs";
|
|
5
6
|
import "../chunk-O475TEG2.mjs";
|
|
6
|
-
|
|
7
|
-
// src/matchers/toBeAt.ts
|
|
8
|
-
var toBeAt = (tester, uc, id) => {
|
|
9
|
-
return match(tester).undefined((t) => t, "Tester is undefined").undefined((t) => t.url, "Tester does not contain a URL").undefined(() => uc, "Use case is undefined").not(
|
|
10
|
-
(t) => t.url.includes(`/${uc?.app.id}`),
|
|
11
|
-
(t) => `We expected the tester to be at app '${uc?.app.id}', but it is at '${t?.url}' instead.`
|
|
12
|
-
).not(
|
|
13
|
-
(t) => t.url.includes(`/${uc?.id}`),
|
|
14
|
-
(t) => `We expected the tester to be at use case '${uc?.id}', but it is at '${t?.url}' instead.`
|
|
15
|
-
).not(
|
|
16
|
-
(t) => t.url.includes(id ? `/${id}` : ""),
|
|
17
|
-
(t) => `We expected the path to contain '/42', but it is '${t?.url}' instead.`
|
|
18
|
-
).else((t) => `The tester is at '${t?.url}'`);
|
|
19
|
-
};
|
|
20
|
-
expect.extend({
|
|
21
|
-
toBeAt
|
|
22
|
-
});
|
|
23
7
|
export {
|
|
24
8
|
toBeAt
|
|
25
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|