@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.
Files changed (87) hide show
  1. package/dist/chunk-6FEQASGO.mjs +17 -0
  2. package/dist/chunk-6FEQASGO.mjs.map +1 -0
  3. package/dist/chunk-ART72TJA.mjs +25 -0
  4. package/dist/chunk-ART72TJA.mjs.map +1 -0
  5. package/dist/chunk-BN2IG45X.mjs +24 -0
  6. package/dist/chunk-BN2IG45X.mjs.map +1 -0
  7. package/dist/chunk-BZXBZCMZ.mjs +26 -0
  8. package/dist/chunk-BZXBZCMZ.mjs.map +1 -0
  9. package/dist/chunk-CQPHLHB7.mjs +86 -0
  10. package/dist/chunk-CQPHLHB7.mjs.map +1 -0
  11. package/dist/chunk-DHDFXV7G.mjs +53 -0
  12. package/dist/chunk-DHDFXV7G.mjs.map +1 -0
  13. package/dist/chunk-DMSYYRBM.mjs +59 -0
  14. package/dist/chunk-DMSYYRBM.mjs.map +1 -0
  15. package/dist/chunk-EZNTPFD2.mjs +39 -0
  16. package/dist/chunk-EZNTPFD2.mjs.map +1 -0
  17. package/dist/chunk-GRYVDJXU.mjs +1 -0
  18. package/dist/chunk-GRYVDJXU.mjs.map +1 -0
  19. package/dist/chunk-MBQSBGEE.mjs +1 -0
  20. package/dist/chunk-MBQSBGEE.mjs.map +1 -0
  21. package/dist/chunk-PPXFT3SX.mjs +14 -0
  22. package/dist/chunk-PPXFT3SX.mjs.map +1 -0
  23. package/dist/chunk-QWLALNJL.mjs +30 -0
  24. package/dist/chunk-QWLALNJL.mjs.map +1 -0
  25. package/dist/chunk-RPYWAKYZ.mjs +39 -0
  26. package/dist/chunk-RPYWAKYZ.mjs.map +1 -0
  27. package/dist/chunk-SGV4XPW3.mjs +27 -0
  28. package/dist/chunk-SGV4XPW3.mjs.map +1 -0
  29. package/dist/chunk-TUE23FNE.mjs +17 -0
  30. package/dist/chunk-TUE23FNE.mjs.map +1 -0
  31. package/dist/chunk-UFDXFCRK.mjs +19 -0
  32. package/dist/chunk-UFDXFCRK.mjs.map +1 -0
  33. package/dist/chunk-UOO6EMXQ.mjs +20 -0
  34. package/dist/chunk-UOO6EMXQ.mjs.map +1 -0
  35. package/dist/chunk-WAKTWLNU.mjs +32 -0
  36. package/dist/chunk-WAKTWLNU.mjs.map +1 -0
  37. package/dist/chunk-YL7PRCYP.mjs +26 -0
  38. package/dist/chunk-YL7PRCYP.mjs.map +1 -0
  39. package/dist/chunk-Z6NXMCUL.mjs +17 -0
  40. package/dist/chunk-Z6NXMCUL.mjs.map +1 -0
  41. package/dist/chunk-ZBSBLFC7.mjs +20 -0
  42. package/dist/chunk-ZBSBLFC7.mjs.map +1 -0
  43. package/dist/index.mjs +150 -2
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/matchers/HttpMatchers.mjs +13 -41
  46. package/dist/matchers/HttpMatchers.mjs.map +1 -1
  47. package/dist/matchers/ResultMatchers.mjs +5 -22
  48. package/dist/matchers/ResultMatchers.mjs.map +1 -1
  49. package/dist/matchers/index.mjs +132 -19
  50. package/dist/matchers/index.mjs.map +1 -1
  51. package/dist/matchers/toBeArrayOf.mjs +3 -8
  52. package/dist/matchers/toBeArrayOf.mjs.map +1 -1
  53. package/dist/matchers/toBeArrayOfWithLength.mjs +3 -11
  54. package/dist/matchers/toBeArrayOfWithLength.mjs.map +1 -1
  55. package/dist/matchers/toBeAt.mjs +3 -19
  56. package/dist/matchers/toBeAt.mjs.map +1 -1
  57. package/dist/matchers/toBeExactlyAt.mjs +4 -20
  58. package/dist/matchers/toBeExactlyAt.mjs.map +1 -1
  59. package/dist/matchers/toBeQueriedWith.mjs +3 -11
  60. package/dist/matchers/toBeQueriedWith.mjs.map +1 -1
  61. package/dist/matchers/toBeRoutedTo.mjs +7 -24
  62. package/dist/matchers/toBeRoutedTo.mjs.map +1 -1
  63. package/dist/matchers/toBeValid.mjs +4 -11
  64. package/dist/matchers/toBeValid.mjs.map +1 -1
  65. package/dist/matchers/toFailMatcher.mjs +6 -29
  66. package/dist/matchers/toFailMatcher.mjs.map +1 -1
  67. package/dist/matchers/toMatchArray.mjs +3 -13
  68. package/dist/matchers/toMatchArray.mjs.map +1 -1
  69. package/dist/matchers/toMatchExactJson.mjs +5 -17
  70. package/dist/matchers/toMatchExactJson.mjs.map +1 -1
  71. package/dist/matchers/toMatchException.mjs +4 -20
  72. package/dist/matchers/toMatchException.mjs.map +1 -1
  73. package/dist/matchers/toMatchJson.mjs +6 -20
  74. package/dist/matchers/toMatchJson.mjs.map +1 -1
  75. package/dist/matchers/toMatchRoute.mjs +4 -14
  76. package/dist/matchers/toMatchRoute.mjs.map +1 -1
  77. package/dist/matchers/toMatchText.mjs +4 -14
  78. package/dist/matchers/toMatchText.mjs.map +1 -1
  79. package/dist/matchers/toPassMatcher.mjs +6 -29
  80. package/dist/matchers/toPassMatcher.mjs.map +1 -1
  81. package/dist/mock/Fits.mjs +7 -44
  82. package/dist/mock/Fits.mjs.map +1 -1
  83. package/dist/mock/Mocks.mjs +4 -79
  84. package/dist/mock/Mocks.mjs.map +1 -1
  85. package/dist/mock/index.mjs +22 -2
  86. package/dist/mock/index.mjs.map +1 -1
  87. 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
- export * from "./matchers";
2
- export * from "./mock";
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
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './matchers';\nexport * from './mock';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,48 +1,20 @@
1
1
  import {
2
- match
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
- toHaveStatus,
44
- toBeBadGateway
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":["../../src/matchers/HttpMatchers.ts"],"sourcesContent":["import { Response } from '../utils/Response';\nimport { match } from './Match';\n\nexport const toHaveStatus = (res: Response, code: number): jest.CustomMatcherResult =>\n match<Response>(res)\n .undefined(r => r, 'Response is unknown.')\n .undefined(\n r => r?.status?.id,\n () => 'Response does not have a status code'\n )\n .not(\n r => r.status.id === code,\n r => `Response does not have code '${code}', but has code '${r.status.id}' instead.`\n )\n .else(`Response does have status code '${code}'.`);\n\nexport const toBeOk = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 200);\n\nexport const toBeCreated = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 201);\n\nexport const toHaveNoContent = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 204);\n\nexport const toBeBadRequest = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 400);\n\nexport const toBeUnauthorized = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 401);\n\nexport const toBeForbidden = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 403);\n\nexport const toBeNotFound = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 404);\n\nexport const toBeConflict = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 409);\n\nexport const toBeInternalServerError = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 500);\n\nexport const toBeBadGateway = (res: Response): jest.CustomMatcherResult => toHaveStatus(res, 502);\n\nexport const toBeOkWithItems = (res: Response, length: number): jest.CustomMatcherResult =>\n match<Response>(res)\n .undefined(r => r.status?.id, 'Response did not have a status')\n .not(\n r => r.status.id === 200,\n r => `Response did not have status '200'. It had status '${r.status.id}' instead.`\n )\n .undefined(r => r?.body?.data?.items, `Response did not have any items.`)\n .not(\n r => (r?.body?.data?.itemCount ?? 0) >= length,\n r => `Response did not have at least ${length} items. It only had ${r?.body?.data?.itemCount ?? 0} items.`\n )\n .else(`Response had status 200 and at least ${length} items`);\n\nexpect.extend({\n toBeOk,\n toBeOkWithItems,\n toBeCreated,\n toHaveNoContent,\n toBeNotFound,\n toBeBadRequest,\n toBeUnauthorized,\n toBeForbidden,\n toBeConflict,\n toBeInternalServerError,\n toHaveStatus,\n toBeBadGateway,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeOk(): R;\n toBeOkWithItems(length: number): R;\n toBeCreated(): R;\n toHaveNoContent(): R;\n toBeNotFound(): R;\n toBeUnauthorized(): R;\n toBeForbidden(): R;\n toBeBadRequest(): R;\n toBeConflict(): R;\n toBeInternalServerError(): R;\n toBeBadGateway(): R;\n toHaveStatus(code: number): R;\n }\n }\n}\n"],"mappings":";;;;;;;AAGO,IAAM,eAAe,CAAC,KAAe,SAC1C,MAAgB,GAAG,EAChB,UAAU,OAAK,GAAG,sBAAsB,EACxC;AAAA,EACC,OAAK,GAAG,QAAQ;AAAA,EAChB,MAAM;AACR,EACC;AAAA,EACC,OAAK,EAAE,OAAO,OAAO;AAAA,EACrB,OAAK,gCAAgC,IAAI,oBAAoB,EAAE,OAAO,EAAE;AAC1E,EACC,KAAK,mCAAmC,IAAI,IAAI;AAE9C,IAAM,SAAS,CAAC,QAA4C,aAAa,KAAK,GAAG;AAEjF,IAAM,cAAc,CAAC,QAA4C,aAAa,KAAK,GAAG;AAEtF,IAAM,kBAAkB,CAAC,QAA4C,aAAa,KAAK,GAAG;AAE1F,IAAM,iBAAiB,CAAC,QAA4C,aAAa,KAAK,GAAG;AAEzF,IAAM,mBAAmB,CAAC,QAA4C,aAAa,KAAK,GAAG;AAE3F,IAAM,gBAAgB,CAAC,QAA4C,aAAa,KAAK,GAAG;AAExF,IAAM,eAAe,CAAC,QAA4C,aAAa,KAAK,GAAG;AAEvF,IAAM,eAAe,CAAC,QAA4C,aAAa,KAAK,GAAG;AAEvF,IAAM,0BAA0B,CAAC,QAA4C,aAAa,KAAK,GAAG;AAElG,IAAM,iBAAiB,CAAC,QAA4C,aAAa,KAAK,GAAG;AAEzF,IAAM,kBAAkB,CAAC,KAAe,WAC7C,MAAgB,GAAG,EAChB,UAAU,OAAK,EAAE,QAAQ,IAAI,gCAAgC,EAC7D;AAAA,EACC,OAAK,EAAE,OAAO,OAAO;AAAA,EACrB,OAAK,sDAAsD,EAAE,OAAO,EAAE;AACxE,EACC,UAAU,OAAK,GAAG,MAAM,MAAM,OAAO,kCAAkC,EACvE;AAAA,EACC,QAAM,GAAG,MAAM,MAAM,aAAa,MAAM;AAAA,EACxC,OAAK,kCAAkC,MAAM,uBAAuB,GAAG,MAAM,MAAM,aAAa,CAAC;AACnG,EACC,KAAK,wCAAwC,MAAM,QAAQ;AAEhE,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,28 +1,11 @@
1
1
  import {
2
- match
3
- } from "../chunk-LN24S2PC.mjs";
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":["../../src/matchers/ResultMatchers.ts"],"sourcesContent":["import { match } from './Match';\nimport { Results } from '../utils/Types';\n\n// Tests for handling Results.\n\nconst notDefined = 'Results is not defined.';\nconst doesNotFail = 'Results does not fail.';\n\nconst hasMessage = (res: Results, message: string) => res.results.some((r: any) => r.message === message);\n\nconst messages = (res: Results): string => \"'\" + res?.results.map(r => r.message).join(\"', '\") + \"'\";\n\nexport const toResultWith = (results: Results, message: string): jest.CustomMatcherResult =>\n match(results)\n .undefined(r => r, notDefined)\n .not(\n r => hasMessage(r, message),\n r => `Results does not have message '${message}', but it has messages ${messages(r)} instead.`\n )\n .else(`Succeeds with message ${message}`);\n\nexport const toFail = (results: Results): jest.CustomMatcherResult =>\n match(results)\n .undefined(r => r, notDefined)\n .not(r => !r.isValid, doesNotFail)\n .else('Results does not fail');\n\nexport const toFailWith = (results: Results, message: string): jest.CustomMatcherResult =>\n match(results)\n .undefined(r => r, notDefined)\n .not(r => !r.isValid, doesNotFail)\n .not(\n r => hasMessage(r, message),\n r => `Fails, but results does not have message '${message}', but it has messages ${messages(r)} instead.`\n )\n .else(`Fails with message '${message}'`);\n\nexpect.extend({\n toResultWith,\n toFail: toFail,\n toFailWith: toFailWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toResultWith(message: string): R;\n toFail(): R;\n toFailWith(message: string): R;\n }\n }\n}\n"],"mappings":";;;;;;;AAKA,IAAM,aAAa;AACnB,IAAM,cAAc;AAEpB,IAAM,aAAa,CAAC,KAAc,YAAoB,IAAI,QAAQ,KAAK,CAAC,MAAW,EAAE,YAAY,OAAO;AAExG,IAAM,WAAW,CAAC,QAAyB,MAAM,KAAK,QAAQ,IAAI,OAAK,EAAE,OAAO,EAAE,KAAK,MAAM,IAAI;AAE1F,IAAM,eAAe,CAAC,SAAkB,YAC7C,MAAM,OAAO,EACV,UAAU,OAAK,GAAG,UAAU,EAC5B;AAAA,EACC,OAAK,WAAW,GAAG,OAAO;AAAA,EAC1B,OAAK,kCAAkC,OAAO,0BAA0B,SAAS,CAAC,CAAC;AACrF,EACC,KAAK,yBAAyB,OAAO,EAAE;AAErC,IAAM,SAAS,CAAC,YACrB,MAAM,OAAO,EACV,UAAU,OAAK,GAAG,UAAU,EAC5B,IAAI,OAAK,CAAC,EAAE,SAAS,WAAW,EAChC,KAAK,uBAAuB;AAE1B,IAAM,aAAa,CAAC,SAAkB,YAC3C,MAAM,OAAO,EACV,UAAU,OAAK,GAAG,UAAU,EAC5B,IAAI,OAAK,CAAC,EAAE,SAAS,WAAW,EAChC;AAAA,EACC,OAAK,WAAW,GAAG,OAAO;AAAA,EAC1B,OAAK,6CAA6C,OAAO,0BAA0B,SAAS,CAAC,CAAC;AAChG,EACC,KAAK,uBAAuB,OAAO,GAAG;AAE3C,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,20 +1,133 @@
1
- export * from "./HttpMatchers";
2
- export * from "./Match";
3
- export * from "./Check";
4
- export * from "./ResultMatchers";
5
- export * from "./toBeArrayOf";
6
- export * from "./toBeArrayOfWithLength";
7
- export * from "./toBeAt";
8
- export * from "./toBeExactlyAt";
9
- export * from "./toFailMatcher";
10
- export * from "./toBeValid";
11
- export * from "./toMatchArray";
12
- export * from "./toMatchExactJson";
13
- export * from "./toMatchException";
14
- export * from "./toMatchJson";
15
- export * from "./toMatchRoute";
16
- export * from "./toMatchText";
17
- export * from "./toPassMatcher";
18
- export * from "./toBeQueriedWith";
19
- export * from "./toBeRoutedTo";
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":["../../src/matchers/index.ts"],"sourcesContent":["export * from './HttpMatchers';\nexport * from './Match';\nexport * from './Check';\nexport * from './ResultMatchers';\nexport * from './toBeArrayOf';\nexport * from './toBeArrayOfWithLength';\nexport * from './toBeAt';\nexport * from './toBeExactlyAt';\nexport * from './toFailMatcher';\nexport * from './toBeValid';\nexport * from './toMatchArray';\nexport * from './toMatchExactJson';\nexport * from './toMatchException';\nexport * from './toMatchJson';\nexport * from './toMatchRoute';\nexport * from './toMatchText';\nexport * from './toPassMatcher';\nexport * from './toBeQueriedWith';\nexport * from './toBeRoutedTo';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,14 +1,9 @@
1
1
  import {
2
- match
3
- } from "../chunk-LN24S2PC.mjs";
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":["../../src/matchers/toBeArrayOf.ts"],"sourcesContent":["import { Constructor as Ctor } from '../utils/Types';\nimport { match } from './Match';\n\nexport const toBeArrayOf = <T>(items: unknown, ctor: Ctor<T>): 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(it => (it as []).every((i: any) => i instanceof ctor), `Not all elements are of type '${ctor.name}'.`)\n .else(`All elements in array are of type '${ctor.name}'`);\n\nexpect.extend({\n toBeArrayOf,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeArrayOf<Z>(ctor: Ctor<Z>): R;\n }\n }\n}\n"],"mappings":";;;;;;;AAGO,IAAM,cAAc,CAAI,OAAgB,SAC7C,MAAe,KAAK,EACjB,UAAU,QAAM,IAAI,uBAAuB,EAC3C,IAAI,QAAM,cAAc,OAAO,0BAA0B,EACzD,IAAI,QAAO,GAAU,MAAM,CAAC,MAAW,aAAa,IAAI,GAAG,iCAAiC,KAAK,IAAI,IAAI,EACzG,KAAK,sCAAsC,KAAK,IAAI,GAAG;AAE5D,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,17 +1,9 @@
1
1
  import {
2
- match
3
- } from "../chunk-LN24S2PC.mjs";
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":["../../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":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,25 +1,9 @@
1
1
  import {
2
- match
3
- } from "../chunk-LN24S2PC.mjs";
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":["../../src/matchers/toBeAt.ts"],"sourcesContent":["import { Id, Tester, UseCase } from '../utils/Types';\nimport { match } from './Match';\n\nexport const toBeAt = (tester?: Tester, uc?: UseCase, id?: Id): jest.CustomMatcherResult => {\n return match<Tester>(tester as Tester)\n .undefined(t => t, 'Tester is undefined')\n .undefined(t => t.url, 'Tester does not contain a URL')\n .undefined(() => uc, 'Use case is undefined')\n .not(\n t => t.url.includes(`/${uc?.app.id}`),\n t => `We expected the tester to be at app '${uc?.app.id}', but it is at '${t?.url}' instead.`\n )\n .not(\n t => t.url.includes(`/${uc?.id}`),\n t => `We expected the tester to be at use case '${uc?.id}', but it is at '${t?.url}' instead.`\n )\n .not(\n t => t.url.includes(id ? `/${id}` : ''),\n t => `We expected the path to contain '/42', but it is '${t?.url}' instead.`\n )\n .else(t => `The tester is at '${t?.url}'`);\n};\n\nexpect.extend({\n toBeAt,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeAt(uc?: UseCase, id?: Id): R;\n }\n }\n}\n"],"mappings":";;;;;;;AAGO,IAAM,SAAS,CAAC,QAAiB,IAAc,OAAsC;AAC1F,SAAO,MAAc,MAAgB,EAClC,UAAU,OAAK,GAAG,qBAAqB,EACvC,UAAU,OAAK,EAAE,KAAK,+BAA+B,EACrD,UAAU,MAAM,IAAI,uBAAuB,EAC3C;AAAA,IACC,OAAK,EAAE,IAAI,SAAS,IAAI,IAAI,IAAI,EAAE,EAAE;AAAA,IACpC,OAAK,wCAAwC,IAAI,IAAI,EAAE,oBAAoB,GAAG,GAAG;AAAA,EACnF,EACC;AAAA,IACC,OAAK,EAAE,IAAI,SAAS,IAAI,IAAI,EAAE,EAAE;AAAA,IAChC,OAAK,6CAA6C,IAAI,EAAE,oBAAoB,GAAG,GAAG;AAAA,EACpF,EACC;AAAA,IACC,OAAK,EAAE,IAAI,SAAS,KAAK,IAAI,EAAE,KAAK,EAAE;AAAA,IACtC,OAAK,qDAAqD,GAAG,GAAG;AAAA,EAClE,EACC,KAAK,OAAK,qBAAqB,GAAG,GAAG,GAAG;AAC7C;AAEA,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}