@thisisagile/easy-test 17.26.0 → 17.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/chunk-6EKWTLNQ.mjs +12 -0
  2. package/dist/chunk-6EKWTLNQ.mjs.map +1 -0
  3. package/dist/chunk-LN24S2PC.mjs +41 -0
  4. package/dist/chunk-LN24S2PC.mjs.map +1 -0
  5. package/dist/chunk-O475TEG2.mjs +30 -0
  6. package/dist/chunk-O475TEG2.mjs.map +1 -0
  7. package/dist/chunk-QE3TR4BY.mjs +16 -0
  8. package/dist/chunk-QE3TR4BY.mjs.map +1 -0
  9. package/dist/chunk-SJR3TRWF.mjs +39 -0
  10. package/dist/chunk-SJR3TRWF.mjs.map +1 -0
  11. package/dist/chunk-Z4XAP66Q.mjs +44 -0
  12. package/dist/chunk-Z4XAP66Q.mjs.map +1 -0
  13. package/dist/index.mjs +2 -541
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/matchers/Check.mjs +10 -0
  16. package/dist/matchers/Check.mjs.map +1 -0
  17. package/dist/matchers/HttpMatchers.mjs +60 -0
  18. package/dist/matchers/HttpMatchers.mjs.map +1 -0
  19. package/dist/matchers/Match.mjs +11 -0
  20. package/dist/matchers/Match.mjs.map +1 -0
  21. package/dist/matchers/ResultMatchers.mjs +31 -0
  22. package/dist/matchers/ResultMatchers.mjs.map +1 -0
  23. package/dist/matchers/index.mjs +20 -0
  24. package/dist/matchers/index.mjs.map +1 -0
  25. package/dist/matchers/toBeArrayOf.mjs +15 -0
  26. package/dist/matchers/toBeArrayOf.mjs.map +1 -0
  27. package/dist/matchers/toBeArrayOfWithLength.mjs +18 -0
  28. package/dist/matchers/toBeArrayOfWithLength.mjs.map +1 -0
  29. package/dist/matchers/toBeAt.mjs +26 -0
  30. package/dist/matchers/toBeAt.mjs.map +1 -0
  31. package/dist/matchers/toBeExactlyAt.mjs +26 -0
  32. package/dist/matchers/toBeExactlyAt.mjs.map +1 -0
  33. package/dist/matchers/toBeQueriedWith.mjs +18 -0
  34. package/dist/matchers/toBeQueriedWith.mjs.map +1 -0
  35. package/dist/matchers/toBeRoutedTo.mjs +32 -0
  36. package/dist/matchers/toBeRoutedTo.mjs.map +1 -0
  37. package/dist/matchers/toBeValid.mjs +17 -0
  38. package/dist/matchers/toBeValid.mjs.map +1 -0
  39. package/dist/matchers/toFailMatcher.mjs +39 -0
  40. package/dist/matchers/toFailMatcher.mjs.map +1 -0
  41. package/dist/matchers/toMatchArray.mjs +19 -0
  42. package/dist/matchers/toMatchArray.mjs.map +1 -0
  43. package/dist/matchers/toMatchExactJson.mjs +25 -0
  44. package/dist/matchers/toMatchExactJson.mjs.map +1 -0
  45. package/dist/matchers/toMatchException.mjs +26 -0
  46. package/dist/matchers/toMatchException.mjs.map +1 -0
  47. package/dist/matchers/toMatchJson.mjs +27 -0
  48. package/dist/matchers/toMatchJson.mjs.map +1 -0
  49. package/dist/matchers/toMatchRoute.mjs +20 -0
  50. package/dist/matchers/toMatchRoute.mjs.map +1 -0
  51. package/dist/matchers/toMatchText.mjs +20 -0
  52. package/dist/matchers/toMatchText.mjs.map +1 -0
  53. package/dist/matchers/toPassMatcher.mjs +39 -0
  54. package/dist/matchers/toPassMatcher.mjs.map +1 -0
  55. package/dist/mock/Fits.mjs +52 -0
  56. package/dist/mock/Fits.mjs.map +1 -0
  57. package/dist/mock/Mocks.mjs +86 -0
  58. package/dist/mock/Mocks.mjs.map +1 -0
  59. package/dist/mock/index.mjs +3 -0
  60. package/dist/mock/index.mjs.map +1 -0
  61. package/dist/utils/Eq.mjs +8 -0
  62. package/dist/utils/Eq.mjs.map +1 -0
  63. package/dist/utils/Req.mjs +8 -0
  64. package/dist/utils/Req.mjs.map +1 -0
  65. package/dist/utils/Response.mjs +1 -0
  66. package/dist/utils/Response.mjs.map +1 -0
  67. package/dist/utils/Types.mjs +8 -0
  68. package/dist/utils/Types.mjs.map +1 -0
  69. package/dist/utils/Utils.mjs +27 -0
  70. package/dist/utils/Utils.mjs.map +1 -0
  71. package/package.json +4 -12
@@ -0,0 +1,60 @@
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,
38
+ toBeBadRequest,
39
+ toBeUnauthorized,
40
+ toBeForbidden,
41
+ toBeConflict,
42
+ toBeInternalServerError,
43
+ toHaveStatus,
44
+ toBeBadGateway
45
+ });
46
+ export {
47
+ toBeBadGateway,
48
+ toBeBadRequest,
49
+ toBeConflict,
50
+ toBeCreated,
51
+ toBeForbidden,
52
+ toBeInternalServerError,
53
+ toBeNotFound,
54
+ toBeOk,
55
+ toBeOkWithItems,
56
+ toBeUnauthorized,
57
+ toHaveNoContent,
58
+ toHaveStatus
59
+ };
60
+ //# sourceMappingURL=HttpMatchers.mjs.map
@@ -0,0 +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":[]}
@@ -0,0 +1,11 @@
1
+ import {
2
+ Match,
3
+ match
4
+ } from "../chunk-LN24S2PC.mjs";
5
+ import "../chunk-6EKWTLNQ.mjs";
6
+ import "../chunk-O475TEG2.mjs";
7
+ export {
8
+ Match,
9
+ match
10
+ };
11
+ //# sourceMappingURL=Match.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,31 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ 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
+ export {
27
+ toFail,
28
+ toFailWith,
29
+ toResultWith
30
+ };
31
+ //# sourceMappingURL=ResultMatchers.mjs.map
@@ -0,0 +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":[]}
@@ -0,0 +1,20 @@
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";
20
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +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":[]}
@@ -0,0 +1,15 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ 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
+ export {
13
+ toBeArrayOf
14
+ };
15
+ //# sourceMappingURL=toBeArrayOf.mjs.map
@@ -0,0 +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":[]}
@@ -0,0 +1,18 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ 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
+ export {
16
+ toBeArrayOfWithLength
17
+ };
18
+ //# sourceMappingURL=toBeArrayOfWithLength.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,26 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ 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
+ export {
24
+ toBeAt
25
+ };
26
+ //# sourceMappingURL=toBeAt.mjs.map
@@ -0,0 +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":[]}
@@ -0,0 +1,26 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ import {
6
+ isDefined
7
+ } from "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toBeExactlyAt.ts
10
+ var toUrl = (uc, id) => {
11
+ const i = isDefined(id) ? `/${id}` : "";
12
+ return `/${uc.app.id}/${uc.id}${i}`;
13
+ };
14
+ var toBeExactlyAt = (tester, uc, id) => {
15
+ 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(
16
+ (t) => t.url.includes(toUrl(uc, id)),
17
+ (t) => `We expected the tester to be at: '${toUrl(uc, id)}', but it is at: '${t?.url}' instead.`
18
+ ).else((t) => `The tester is at '${t?.url}'`);
19
+ };
20
+ expect.extend({
21
+ toBeExactlyAt
22
+ });
23
+ export {
24
+ toBeExactlyAt
25
+ };
26
+ //# sourceMappingURL=toBeExactlyAt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/toBeExactlyAt.ts"],"sourcesContent":["import { Id, Tester, UseCase } from '../utils/Types';\nimport { isDefined } from '../utils/Utils';\nimport { match } from './Match';\n\nconst toUrl = (uc: UseCase, id?: Id): string => {\n const i = isDefined(id) ? `/${id}` : '';\n return `/${uc.app.id}/${uc.id}${i}`;\n};\n\nexport const toBeExactlyAt = (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(toUrl(uc as UseCase, id)),\n t => `We expected the tester to be at: '${toUrl(uc as UseCase, id)}', but it is at: '${t?.url}' instead.`\n )\n .else(t => `The tester is at '${t?.url}'`);\n};\n\nexpect.extend({\n toBeExactlyAt,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeExactlyAt(uc?: UseCase, id?: Id): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAIA,IAAM,QAAQ,CAAC,IAAa,OAAoB;AAC9C,QAAM,IAAI,UAAU,EAAE,IAAI,IAAI,EAAE,KAAK;AACrC,SAAO,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,EAAE,GAAG,CAAC;AACnC;AAEO,IAAM,gBAAgB,CAAC,QAAiB,IAAc,OAAsC;AACjG,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,MAAM,IAAe,EAAE,CAAC;AAAA,IAC5C,OAAK,qCAAqC,MAAM,IAAe,EAAE,CAAC,qBAAqB,GAAG,GAAG;AAAA,EAC/F,EACC,KAAK,OAAK,qBAAqB,GAAG,GAAG,GAAG;AAC7C;AAEA,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -0,0 +1,18 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ import "../chunk-O475TEG2.mjs";
6
+
7
+ // src/matchers/toBeQueriedWith.ts
8
+ var toBeQueriedWith = (query, expected) => match(query?.mock?.calls).undefined((c) => c, "Query is unknown.").not((c) => c.length === 1, "Query did not execute.").not(
9
+ (c) => c[0][0].toString() === expected?.toString(),
10
+ (c) => `We expected query '${expected}', but we received query '${c[0][0]}' instead.`
11
+ ).else(`Received query does match '${expected}'`);
12
+ expect.extend({
13
+ toBeQueriedWith
14
+ });
15
+ export {
16
+ toBeQueriedWith
17
+ };
18
+ //# sourceMappingURL=toBeQueriedWith.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/toBeQueriedWith.ts"],"sourcesContent":["import { match } from './Match';\nimport { Query } from '../utils/Types';\n\nexport const toBeQueriedWith = (query: jest.Mock, expected: Query): jest.CustomMatcherResult =>\n match<any[]>(query?.mock?.calls)\n .undefined(c => c, 'Query is unknown.')\n .not(c => c.length === 1, 'Query did not execute.')\n .not(\n c => c[0][0].toString() === expected?.toString(),\n c => `We expected query '${expected}', but we received query '${c[0][0]}' instead.`\n )\n .else(`Received query does match '${expected}'`);\n\nexpect.extend({\n toBeQueriedWith: toBeQueriedWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeQueriedWith(expected: Query): R;\n }\n }\n}\n"],"mappings":";;;;;;;AAGO,IAAM,kBAAkB,CAAC,OAAkB,aAChD,MAAa,OAAO,MAAM,KAAK,EAC5B,UAAU,OAAK,GAAG,mBAAmB,EACrC,IAAI,OAAK,EAAE,WAAW,GAAG,wBAAwB,EACjD;AAAA,EACC,OAAK,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,MAAM,UAAU,SAAS;AAAA,EAC/C,OAAK,sBAAsB,QAAQ,6BAA6B,EAAE,CAAC,EAAE,CAAC,CAAC;AACzE,EACC,KAAK,8BAA8B,QAAQ,GAAG;AAEnD,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -0,0 +1,32 @@
1
+ import {
2
+ checkDefined
3
+ } from "../chunk-Z4XAP66Q.mjs";
4
+ import {
5
+ match
6
+ } from "../chunk-LN24S2PC.mjs";
7
+ import "../chunk-6EKWTLNQ.mjs";
8
+ import {
9
+ asString
10
+ } from "../chunk-O475TEG2.mjs";
11
+
12
+ // src/matchers/toBeRoutedTo.ts
13
+ var weExpectedButReceivedInstead = ([r, e]) => `We expected ${asString(e)}, but we received '${asString(r)}' instead.`;
14
+ function toMatchAsString(received, expected) {
15
+ return checkDefined(this, received, expected).not(
16
+ ([r, e]) => this.equals(asString(r), asString(e)),
17
+ ([r, e]) => weExpectedButReceivedInstead([r, e])
18
+ ).else();
19
+ }
20
+ var toBeRoutedTo = (query, expected) => match(query?.mock?.calls).undefined((c) => c, "Uri is unknown.").not((c) => c.length === 1, "Method was not called.").not(
21
+ (c) => asString(c[0][0]) === asString(expected),
22
+ (c) => `We expected uri '${asString(expected)}', but we received uri '${asString(c[0][0])}' instead.`
23
+ ).else(`Called uri does match '${asString(expected)}'`);
24
+ expect.extend({
25
+ toBeRoutedTo
26
+ });
27
+ export {
28
+ toBeRoutedTo,
29
+ toMatchAsString,
30
+ weExpectedButReceivedInstead
31
+ };
32
+ //# sourceMappingURL=toBeRoutedTo.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,17 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ import {
6
+ isA
7
+ } from "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toBeValid.ts
10
+ var toBeValid = (v) => match(v).undefined((s) => s, "Subject is undefined.").not((s) => isA(s, "isValid"), "Subject is not validatable.").not((s) => s.isValid, `Subject is not valid.`).else(`Subject is valid`);
11
+ expect.extend({
12
+ toBeValid
13
+ });
14
+ export {
15
+ toBeValid
16
+ };
17
+ //# sourceMappingURL=toBeValid.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/toBeValid.ts"],"sourcesContent":["import { Validatable } from '../utils/Types';\nimport { isA } from '../utils/Utils';\nimport { match } from './Match';\n\nexport const toBeValid = (v?: unknown): jest.CustomMatcherResult =>\n match<Validatable>(v as Validatable)\n .undefined(s => s, 'Subject is undefined.')\n .not(s => isA<Validatable>(s, 'isValid'), 'Subject is not validatable.')\n .not(s => s.isValid, `Subject is not valid.`)\n .else(`Subject is valid`);\n\nexpect.extend({\n toBeValid,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toBeValid(): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAIO,IAAM,YAAY,CAAC,MACxB,MAAmB,CAAgB,EAChC,UAAU,OAAK,GAAG,uBAAuB,EACzC,IAAI,OAAK,IAAiB,GAAG,SAAS,GAAG,6BAA6B,EACtE,IAAI,OAAK,EAAE,SAAS,uBAAuB,EAC3C,KAAK,kBAAkB;AAE5B,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -0,0 +1,39 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import {
5
+ toMessage
6
+ } from "../chunk-6EKWTLNQ.mjs";
7
+ import "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toFailMatcher.ts
10
+ var Fails = {
11
+ Yes: "Match fails, instead of passes.",
12
+ No: (reason) => `Match doesn't fail, because '${reason}'`
13
+ };
14
+ var FailsWith = {
15
+ Yes: "Match fails with correct message.",
16
+ No: (message, instead) => `Match does fail, however not with message '${message}', but with message '${instead}' instead.`
17
+ };
18
+ var toFailMatcher = (result) => match(result).not(
19
+ (c) => !c.pass,
20
+ (c) => Fails.No(c.message())
21
+ ).else(Fails.Yes);
22
+ var toFailMatcherWith = (result, message) => match(result).not(
23
+ (c) => !c.pass,
24
+ (c) => Fails.No(c.message())
25
+ ).not(
26
+ (c) => c.message().includes(toMessage(message)),
27
+ (c) => FailsWith.No(toMessage(message), c.message())
28
+ ).else(FailsWith.Yes);
29
+ expect.extend({
30
+ toFailMatcher,
31
+ toFailMatcherWith
32
+ });
33
+ export {
34
+ Fails,
35
+ FailsWith,
36
+ toFailMatcher,
37
+ toFailMatcherWith
38
+ };
39
+ //# sourceMappingURL=toFailMatcher.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/toFailMatcher.ts"],"sourcesContent":["import { match } from './Match';\nimport { Message, toMessage } from '../utils/Types';\n\n// Handles CustomMatcherResult validations.\n\nexport const Fails = {\n Yes: 'Match fails, instead of passes.',\n No: (reason: string): string => `Match doesn't fail, because '${reason}'`,\n};\n\nexport const FailsWith = {\n Yes: 'Match fails with correct message.',\n No: (message: string, instead: string): string => `Match does fail, however not with message '${message}', but with message '${instead}' instead.`,\n};\n\nexport const toFailMatcher = (result: jest.CustomMatcherResult): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => !c.pass,\n c => Fails.No(c.message())\n )\n .else(Fails.Yes);\n\nexport const toFailMatcherWith = (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => !c.pass,\n c => Fails.No(c.message())\n )\n .not(\n c => c.message().includes(toMessage(message)),\n c => FailsWith.No(toMessage(message), c.message())\n )\n .else(FailsWith.Yes);\n\nexpect.extend({\n toFailMatcher: toFailMatcher,\n toFailMatcherWith: toFailMatcherWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toFailMatcher(): R;\n\n toFailMatcherWith(message: string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAKO,IAAM,QAAQ;AAAA,EACnB,KAAK;AAAA,EACL,IAAI,CAAC,WAA2B,gCAAgC,MAAM;AACxE;AAEO,IAAM,YAAY;AAAA,EACvB,KAAK;AAAA,EACL,IAAI,CAAC,SAAiB,YAA4B,8CAA8C,OAAO,wBAAwB,OAAO;AACxI;AAEO,IAAM,gBAAgB,CAAC,WAC5B,MAAM,MAAM,EACT;AAAA,EACC,OAAK,CAAC,EAAE;AAAA,EACR,OAAK,MAAM,GAAG,EAAE,QAAQ,CAAC;AAC3B,EACC,KAAK,MAAM,GAAG;AAEZ,IAAM,oBAAoB,CAAC,QAAkC,YAClE,MAAM,MAAM,EACT;AAAA,EACC,OAAK,CAAC,EAAE;AAAA,EACR,OAAK,MAAM,GAAG,EAAE,QAAQ,CAAC;AAC3B,EACC;AAAA,EACC,OAAK,EAAE,QAAQ,EAAE,SAAS,UAAU,OAAO,CAAC;AAAA,EAC5C,OAAK,UAAU,GAAG,UAAU,OAAO,GAAG,EAAE,QAAQ,CAAC;AACnD,EACC,KAAK,UAAU,GAAG;AAEvB,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AACF,CAAC;","names":[]}
@@ -0,0 +1,19 @@
1
+ import {
2
+ checkDefined
3
+ } from "../chunk-Z4XAP66Q.mjs";
4
+ import "../chunk-O475TEG2.mjs";
5
+
6
+ // src/matchers/toMatchArray.ts
7
+ function toMatchArray(received, expected) {
8
+ return checkDefined(this, received, expected).not(
9
+ ([r, e]) => r.length === e.length,
10
+ ([r, e]) => `Received array has length ${r.length}, while expected array has length ${e.length}.`
11
+ ).not(([r, e]) => r.every((el, i) => this.equals(el, e[i])), "Elements in {r} do not match elements in {e}. \n\n {diff}.").else();
12
+ }
13
+ expect.extend({
14
+ toMatchArray
15
+ });
16
+ export {
17
+ toMatchArray
18
+ };
19
+ //# sourceMappingURL=toMatchArray.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/toMatchArray.ts"],"sourcesContent":["import { checkDefined } from './Check';\n\nexport function toMatchArray(this: jest.MatcherContext, received: any[], expected: any[]) {\n return checkDefined(this, received, expected)\n .not(\n ([r, e]) => r.length === e.length,\n ([r, e]) => `Received array has length ${r.length}, while expected array has length ${e.length}.`\n )\n .not(([r, e]) => r.every((el, i) => this.equals(el, e[i])), 'Elements in {r} do not match elements in {e}. \\n\\n {diff}.')\n .else();\n}\n\nexpect.extend({\n toMatchArray,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchArray(expected: any[]): R;\n }\n }\n}\n"],"mappings":";;;;;;AAEO,SAAS,aAAwC,UAAiB,UAAiB;AACxF,SAAO,aAAa,MAAM,UAAU,QAAQ,EACzC;AAAA,IACC,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE;AAAA,IAC3B,CAAC,CAAC,GAAG,CAAC,MAAM,6BAA6B,EAAE,MAAM,qCAAqC,EAAE,MAAM;AAAA,EAChG,EACC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,MAAM,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,4DAA4D,EACvH,KAAK;AACV;AAEA,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -0,0 +1,25 @@
1
+ import {
2
+ eq
3
+ } from "../chunk-QE3TR4BY.mjs";
4
+ import {
5
+ match
6
+ } from "../chunk-LN24S2PC.mjs";
7
+ import "../chunk-6EKWTLNQ.mjs";
8
+ import "../chunk-O475TEG2.mjs";
9
+
10
+ // src/matchers/toMatchExactJson.ts
11
+ var MatchesExactJson = {
12
+ SubjectUndefined: "Subject is undefined.",
13
+ SubsetUndefined: "Object to match with is undefined.",
14
+ DoesNotMatch: "Object does not exactly match subject.",
15
+ Yes: "Object matches subject exactly"
16
+ };
17
+ var 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);
18
+ expect.extend({
19
+ toMatchExactJson
20
+ });
21
+ export {
22
+ MatchesExactJson,
23
+ toMatchExactJson
24
+ };
25
+ //# 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":";;;;;;;;;;AAGO,IAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,IAAM,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,26 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ import {
6
+ isDefined
7
+ } from "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toMatchException.ts
10
+ var toMatchException = (received, expected, reason) => match(expected).undefined((e) => e.id, "Expected value is not an exception.").not(
11
+ (e) => e.id === received.id,
12
+ (e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`
13
+ ).not(
14
+ () => !isDefined(reason) || isDefined(reason) && isDefined(received.reason),
15
+ () => `We expected to have reason '${reason}', but we received no reason.`
16
+ ).not(
17
+ () => !isDefined(reason) || isDefined(reason) && received.reason === reason,
18
+ () => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`
19
+ ).else(`Expected exception matches received exception`);
20
+ expect.extend({
21
+ toMatchException
22
+ });
23
+ export {
24
+ toMatchException
25
+ };
26
+ //# 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":";;;;;;;;;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,27 @@
1
+ import {
2
+ eq
3
+ } from "../chunk-QE3TR4BY.mjs";
4
+ import {
5
+ match
6
+ } from "../chunk-LN24S2PC.mjs";
7
+ import "../chunk-6EKWTLNQ.mjs";
8
+ import {
9
+ asJson
10
+ } from "../chunk-O475TEG2.mjs";
11
+
12
+ // src/matchers/toMatchJson.ts
13
+ var MatchesJson = {
14
+ SubjectUndefined: "Subject is undefined.",
15
+ SubsetUndefined: "Subset to match with is undefined.",
16
+ DoesNotMatch: "Subset does not match subject.",
17
+ Yes: "Subset matches subject"
18
+ };
19
+ var 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);
20
+ expect.extend({
21
+ toMatchJson
22
+ });
23
+ export {
24
+ MatchesJson,
25
+ toMatchJson
26
+ };
27
+ //# 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":";;;;;;;;;;;;AAIO,IAAM,cAAc;AAAA,EACzB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,IAAM,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,20 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ import {
6
+ asString
7
+ } from "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toMatchRoute.ts
10
+ var toMatchRoute = (uri, route) => match(uri).undefined((u) => u, "Subject is undefined.").undefined(() => route, "Route to include is undefined.").not(
11
+ (u) => asString(u).includes(asString(route)),
12
+ (u) => `Uri '${u}' does not include '${route}'.`
13
+ ).else((u) => `Uri '${u}' includes '${route}'`);
14
+ expect.extend({
15
+ toMatchRoute
16
+ });
17
+ export {
18
+ toMatchRoute
19
+ };
20
+ //# 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":";;;;;;;;;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":[]}
@@ -0,0 +1,20 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import "../chunk-6EKWTLNQ.mjs";
5
+ import {
6
+ asString
7
+ } from "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toMatchText.ts
10
+ var toMatchText = (value, text) => match(value).undefined((v) => v, "Subject is undefined.").undefined(() => text, "Text to match with is undefined.").not(
11
+ (v) => asString(v) === asString(text),
12
+ (v) => `Text '${v}' does not match with text '${text}'.`
13
+ ).else((v) => `Text '${v}' matches`);
14
+ expect.extend({
15
+ toMatchText
16
+ });
17
+ export {
18
+ toMatchText
19
+ };
20
+ //# 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":";;;;;;;;;AAGO,IAAM,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,39 @@
1
+ import {
2
+ match
3
+ } from "../chunk-LN24S2PC.mjs";
4
+ import {
5
+ toMessage
6
+ } from "../chunk-6EKWTLNQ.mjs";
7
+ import "../chunk-O475TEG2.mjs";
8
+
9
+ // src/matchers/toPassMatcher.ts
10
+ var Passes = {
11
+ Yes: "Match passes, instead of fails.",
12
+ No: (reason) => `Match doesn't pass, because '${reason}'`
13
+ };
14
+ var PassesWith = {
15
+ Yes: "Match passes with correct message.",
16
+ No: (message, instead) => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`
17
+ };
18
+ var toPassMatcher = (result) => match(result).not(
19
+ (c) => c.pass,
20
+ (c) => Passes.No(c.message())
21
+ ).else(Passes.Yes);
22
+ var toPassMatcherWith = (result, message) => match(result).not(
23
+ (c) => c.pass,
24
+ (c) => Passes.No(c.message())
25
+ ).not(
26
+ (c) => c.message().includes(toMessage(message)),
27
+ (c) => PassesWith.No(toMessage(message), c.message())
28
+ ).else(PassesWith.Yes);
29
+ expect.extend({
30
+ toPassMatcher,
31
+ toPassMatcherWith
32
+ });
33
+ export {
34
+ Passes,
35
+ PassesWith,
36
+ toPassMatcher,
37
+ toPassMatcherWith
38
+ };
39
+ //# sourceMappingURL=toPassMatcher.mjs.map