@thisisagile/easy-test 15.26.2 → 15.27.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 (121) hide show
  1. package/dist/chunk-6EKWTLNQ.mjs +12 -0
  2. package/dist/chunk-6EKWTLNQ.mjs.map +1 -0
  3. package/dist/chunk-KAVJOG5T.mjs +39 -0
  4. package/dist/chunk-KAVJOG5T.mjs.map +1 -0
  5. package/dist/chunk-LN24S2PC.mjs +41 -0
  6. package/dist/chunk-LN24S2PC.mjs.map +1 -0
  7. package/dist/chunk-O475TEG2.mjs +30 -0
  8. package/dist/chunk-O475TEG2.mjs.map +1 -0
  9. package/dist/chunk-QE3TR4BY.mjs +16 -0
  10. package/dist/chunk-QE3TR4BY.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.js +590 -5
  14. package/dist/index.js.map +1 -1
  15. package/dist/matchers/Check.mjs +5 -34
  16. package/dist/matchers/Check.mjs.map +1 -1
  17. package/dist/matchers/HttpMatchers.mjs +19 -13
  18. package/dist/matchers/HttpMatchers.mjs.map +1 -1
  19. package/dist/matchers/Match.mjs +6 -29
  20. package/dist/matchers/Match.mjs.map +1 -1
  21. package/dist/matchers/ResultMatchers.mjs +14 -8
  22. package/dist/matchers/ResultMatchers.mjs.map +1 -1
  23. package/dist/matchers/toBeArrayOf.mjs +8 -2
  24. package/dist/matchers/toBeArrayOf.mjs.map +1 -1
  25. package/dist/matchers/toBeArrayOfWithLength.mjs +8 -2
  26. package/dist/matchers/toBeArrayOfWithLength.mjs.map +1 -1
  27. package/dist/matchers/toBeAt.mjs +8 -2
  28. package/dist/matchers/toBeAt.mjs.map +1 -1
  29. package/dist/matchers/toBeExactlyAt.mjs +11 -4
  30. package/dist/matchers/toBeExactlyAt.mjs.map +1 -1
  31. package/dist/matchers/toBeQueriedWith.mjs +8 -2
  32. package/dist/matchers/toBeQueriedWith.mjs.map +1 -1
  33. package/dist/matchers/toBeRoutedTo.mjs +14 -5
  34. package/dist/matchers/toBeRoutedTo.mjs.map +1 -1
  35. package/dist/matchers/toBeValid.mjs +10 -3
  36. package/dist/matchers/toBeValid.mjs.map +1 -1
  37. package/dist/matchers/toFailMatcher.mjs +13 -6
  38. package/dist/matchers/toFailMatcher.mjs.map +1 -1
  39. package/dist/matchers/toMatchArray.mjs +6 -1
  40. package/dist/matchers/toMatchArray.mjs.map +1 -1
  41. package/dist/matchers/toMatchExactJson.mjs +12 -4
  42. package/dist/matchers/toMatchExactJson.mjs.map +1 -1
  43. package/dist/matchers/toMatchException.mjs +10 -3
  44. package/dist/matchers/toMatchException.mjs.map +1 -1
  45. package/dist/matchers/toMatchJson.mjs +14 -5
  46. package/dist/matchers/toMatchJson.mjs.map +1 -1
  47. package/dist/matchers/toMatchRoute.mjs +10 -3
  48. package/dist/matchers/toMatchRoute.mjs.map +1 -1
  49. package/dist/matchers/toMatchText.mjs +10 -3
  50. package/dist/matchers/toMatchText.mjs.map +1 -1
  51. package/dist/matchers/toPassMatcher.mjs +13 -6
  52. package/dist/matchers/toPassMatcher.mjs.map +1 -1
  53. package/dist/mock/Fits.mjs +17 -9
  54. package/dist/mock/Fits.mjs.map +1 -1
  55. package/dist/mock/Mocks.mjs +9 -4
  56. package/dist/mock/Mocks.mjs.map +1 -1
  57. package/dist/utils/Eq.mjs +4 -7
  58. package/dist/utils/Eq.mjs.map +1 -1
  59. package/dist/utils/Req.mjs +4 -29
  60. package/dist/utils/Req.mjs.map +1 -1
  61. package/dist/utils/Types.mjs +4 -2
  62. package/dist/utils/Types.mjs.map +1 -1
  63. package/dist/utils/Utils.mjs +13 -14
  64. package/dist/utils/Utils.mjs.map +1 -1
  65. package/package.json +3 -2
  66. package/dist/matchers/Check.js +0 -64
  67. package/dist/matchers/Check.js.map +0 -1
  68. package/dist/matchers/HttpMatchers.js +0 -89
  69. package/dist/matchers/HttpMatchers.js.map +0 -1
  70. package/dist/matchers/Match.js +0 -59
  71. package/dist/matchers/Match.js.map +0 -1
  72. package/dist/matchers/ResultMatchers.js +0 -51
  73. package/dist/matchers/ResultMatchers.js.map +0 -1
  74. package/dist/matchers/index.js +0 -59
  75. package/dist/matchers/index.js.map +0 -1
  76. package/dist/matchers/toBeArrayOf.js +0 -33
  77. package/dist/matchers/toBeArrayOf.js.map +0 -1
  78. package/dist/matchers/toBeArrayOfWithLength.js +0 -36
  79. package/dist/matchers/toBeArrayOfWithLength.js.map +0 -1
  80. package/dist/matchers/toBeAt.js +0 -44
  81. package/dist/matchers/toBeAt.js.map +0 -1
  82. package/dist/matchers/toBeExactlyAt.js +0 -43
  83. package/dist/matchers/toBeExactlyAt.js.map +0 -1
  84. package/dist/matchers/toBeQueriedWith.js +0 -36
  85. package/dist/matchers/toBeQueriedWith.js.map +0 -1
  86. package/dist/matchers/toBeRoutedTo.js +0 -49
  87. package/dist/matchers/toBeRoutedTo.js.map +0 -1
  88. package/dist/matchers/toBeValid.js +0 -34
  89. package/dist/matchers/toBeValid.js.map +0 -1
  90. package/dist/matchers/toFailMatcher.js +0 -59
  91. package/dist/matchers/toFailMatcher.js.map +0 -1
  92. package/dist/matchers/toMatchArray.js +0 -38
  93. package/dist/matchers/toMatchArray.js.map +0 -1
  94. package/dist/matchers/toMatchExactJson.js +0 -42
  95. package/dist/matchers/toMatchExactJson.js.map +0 -1
  96. package/dist/matchers/toMatchException.js +0 -43
  97. package/dist/matchers/toMatchException.js.map +0 -1
  98. package/dist/matchers/toMatchJson.js +0 -43
  99. package/dist/matchers/toMatchJson.js.map +0 -1
  100. package/dist/matchers/toMatchRoute.js +0 -37
  101. package/dist/matchers/toMatchRoute.js.map +0 -1
  102. package/dist/matchers/toMatchText.js +0 -37
  103. package/dist/matchers/toMatchText.js.map +0 -1
  104. package/dist/matchers/toPassMatcher.js +0 -59
  105. package/dist/matchers/toPassMatcher.js.map +0 -1
  106. package/dist/mock/Fits.js +0 -71
  107. package/dist/mock/Fits.js.map +0 -1
  108. package/dist/mock/Mocks.js +0 -98
  109. package/dist/mock/Mocks.js.map +0 -1
  110. package/dist/mock/index.js +0 -25
  111. package/dist/mock/index.js.map +0 -1
  112. package/dist/utils/Eq.js +0 -35
  113. package/dist/utils/Eq.js.map +0 -1
  114. package/dist/utils/Req.js +0 -57
  115. package/dist/utils/Req.js.map +0 -1
  116. package/dist/utils/Response.js +0 -17
  117. package/dist/utils/Response.js.map +0 -1
  118. package/dist/utils/Types.js +0 -30
  119. package/dist/utils/Types.js.map +0 -1
  120. package/dist/utils/Utils.js +0 -62
  121. package/dist/utils/Utils.js.map +0 -1
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toFailMatcher_exports = {};
20
- __export(toFailMatcher_exports, {
21
- Fails: () => Fails,
22
- FailsWith: () => FailsWith,
23
- toFailMatcher: () => toFailMatcher,
24
- toFailMatcherWith: () => toFailMatcherWith
25
- });
26
- module.exports = __toCommonJS(toFailMatcher_exports);
27
- var import_Match = require("./Match");
28
- var import_Types = require("../utils/Types");
29
- const Fails = {
30
- Yes: "Match fails, instead of passes.",
31
- No: (reason) => `Match doesn't fail, because '${reason}'`
32
- };
33
- const FailsWith = {
34
- Yes: "Match fails with correct message.",
35
- No: (message, instead) => `Match does fail, however not with message '${message}', but with message '${instead}' instead.`
36
- };
37
- const toFailMatcher = (result) => (0, import_Match.match)(result).not(
38
- (c) => !c.pass,
39
- (c) => Fails.No(c.message())
40
- ).else(Fails.Yes);
41
- const toFailMatcherWith = (result, message) => (0, import_Match.match)(result).not(
42
- (c) => !c.pass,
43
- (c) => Fails.No(c.message())
44
- ).not(
45
- (c) => c.message().includes((0, import_Types.toMessage)(message)),
46
- (c) => FailsWith.No((0, import_Types.toMessage)(message), c.message())
47
- ).else(FailsWith.Yes);
48
- expect.extend({
49
- toFailMatcher,
50
- toFailMatcherWith
51
- });
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- Fails,
55
- FailsWith,
56
- toFailMatcher,
57
- toFailMatcherWith
58
- });
59
- //# sourceMappingURL=toFailMatcher.js.map
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,mBAAmC;AAI5B,MAAM,QAAQ;AAAA,EACnB,KAAK;AAAA,EACL,IAAI,CAAC,WAA2B,gCAAgC,MAAM;AACxE;AAEO,MAAM,YAAY;AAAA,EACvB,KAAK;AAAA,EACL,IAAI,CAAC,SAAiB,YAA4B,8CAA8C,OAAO,wBAAwB,OAAO;AACxI;AAEO,MAAM,gBAAgB,CAAC,eAC5B,oBAAM,MAAM,EACT;AAAA,EACC,OAAK,CAAC,EAAE;AAAA,EACR,OAAK,MAAM,GAAG,EAAE,QAAQ,CAAC;AAC3B,EACC,KAAK,MAAM,GAAG;AAEZ,MAAM,oBAAoB,CAAC,QAAkC,gBAClE,oBAAM,MAAM,EACT;AAAA,EACC,OAAK,CAAC,EAAE;AAAA,EACR,OAAK,MAAM,GAAG,EAAE,QAAQ,CAAC;AAC3B,EACC;AAAA,EACC,OAAK,EAAE,QAAQ,EAAE,aAAS,wBAAU,OAAO,CAAC;AAAA,EAC5C,OAAK,UAAU,OAAG,wBAAU,OAAO,GAAG,EAAE,QAAQ,CAAC;AACnD,EACC,KAAK,UAAU,GAAG;AAEvB,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AACF,CAAC;","names":[]}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toMatchArray_exports = {};
20
- __export(toMatchArray_exports, {
21
- toMatchArray: () => toMatchArray
22
- });
23
- module.exports = __toCommonJS(toMatchArray_exports);
24
- var import_Check = require("./Check");
25
- function toMatchArray(received, expected) {
26
- return (0, import_Check.checkDefined)(this, received, expected).not(
27
- ([r, e]) => r.length === e.length,
28
- ([r, e]) => `Received array has length ${r.length}, while expected array has length ${e.length}.`
29
- ).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();
30
- }
31
- expect.extend({
32
- toMatchArray
33
- });
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- toMatchArray
37
- });
38
- //# sourceMappingURL=toMatchArray.js.map
@@ -1 +0,0 @@
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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAEtB,SAAS,aAAwC,UAAiB,UAAiB;AACxF,aAAO,2BAAa,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":[]}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toMatchExactJson_exports = {};
20
- __export(toMatchExactJson_exports, {
21
- MatchesExactJson: () => MatchesExactJson,
22
- toMatchExactJson: () => toMatchExactJson
23
- });
24
- module.exports = __toCommonJS(toMatchExactJson_exports);
25
- var import_Match = require("./Match");
26
- var import_Eq = require("../utils/Eq");
27
- const MatchesExactJson = {
28
- SubjectUndefined: "Subject is undefined.",
29
- SubsetUndefined: "Object to match with is undefined.",
30
- DoesNotMatch: "Object does not exactly match subject.",
31
- Yes: "Object matches subject exactly"
32
- };
33
- const toMatchExactJson = (value, json) => (0, import_Match.match)(value).undefined((v) => v, MatchesExactJson.SubjectUndefined).undefined(() => json, MatchesExactJson.SubsetUndefined).not((v) => import_Eq.eq.exact(v, json), MatchesExactJson.DoesNotMatch).else(() => MatchesExactJson.Yes);
34
- expect.extend({
35
- toMatchExactJson
36
- });
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- MatchesExactJson,
40
- toMatchExactJson
41
- });
42
- //# sourceMappingURL=toMatchExactJson.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/matchers/toMatchExactJson.ts"],"sourcesContent":["import { match } from './Match';\nimport { eq } from '../utils/Eq';\n\nexport const MatchesExactJson = {\n SubjectUndefined: 'Subject is undefined.',\n SubsetUndefined: 'Object to match with is undefined.',\n DoesNotMatch: 'Object does not exactly match subject.',\n Yes: 'Object matches subject exactly',\n};\n\nexport const toMatchExactJson = (value?: unknown, json?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, MatchesExactJson.SubjectUndefined)\n .undefined(() => json, MatchesExactJson.SubsetUndefined)\n .not(v => eq.exact(v, json), MatchesExactJson.DoesNotMatch)\n .else(() => MatchesExactJson.Yes);\n\nexpect.extend({\n toMatchExactJson: toMatchExactJson,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchExactJson(json?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,gBAAmB;AAEZ,MAAM,mBAAmB;AAAA,EAC9B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,mBAAmB,CAAC,OAAiB,aAChD,oBAAe,KAAK,EACjB,UAAU,OAAK,GAAG,iBAAiB,gBAAgB,EACnD,UAAU,MAAM,MAAM,iBAAiB,eAAe,EACtD,IAAI,OAAK,aAAG,MAAM,GAAG,IAAI,GAAG,iBAAiB,YAAY,EACzD,KAAK,MAAM,iBAAiB,GAAG;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toMatchException_exports = {};
20
- __export(toMatchException_exports, {
21
- toMatchException: () => toMatchException
22
- });
23
- module.exports = __toCommonJS(toMatchException_exports);
24
- var import_Match = require("./Match");
25
- var import_Utils = require("../utils/Utils");
26
- const toMatchException = (received, expected, reason) => (0, import_Match.match)(expected).undefined((e) => e.id, "Expected value is not an exception.").not(
27
- (e) => e.id === received.id,
28
- (e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`
29
- ).not(
30
- () => !(0, import_Utils.isDefined)(reason) || (0, import_Utils.isDefined)(reason) && (0, import_Utils.isDefined)(received.reason),
31
- () => `We expected to have reason '${reason}', but we received no reason.`
32
- ).not(
33
- () => !(0, import_Utils.isDefined)(reason) || (0, import_Utils.isDefined)(reason) && received.reason === reason,
34
- () => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`
35
- ).else(`Expected exception matches received exception`);
36
- expect.extend({
37
- toMatchException
38
- });
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- toMatchException
42
- });
43
- //# sourceMappingURL=toMatchException.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/matchers/toMatchException.ts"],"sourcesContent":["import { Exception } from '../utils/Types';\nimport { match } from './Match';\nimport { isDefined } from '../utils/Utils';\n\nexport const toMatchException = (received: Exception, expected: unknown, reason?: string): jest.CustomMatcherResult =>\n match<Exception>(expected as Exception)\n .undefined(e => e.id, 'Expected value is not an exception.')\n .not(\n e => e.id === received.id,\n e => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`\n )\n .not(\n () => !isDefined(reason) || (isDefined(reason) && isDefined(received.reason)),\n () => `We expected to have reason '${reason}', but we received no reason.`\n )\n .not(\n () => !isDefined(reason) || (isDefined(reason) && received.reason === reason),\n () => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`\n )\n .else(`Expected exception matches received exception`);\n\nexpect.extend({\n toMatchException,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchException(exception: unknown, reason?: string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsB;AACtB,mBAA0B;AAEnB,MAAM,mBAAmB,CAAC,UAAqB,UAAmB,eACvE,oBAAiB,QAAqB,EACnC,UAAU,OAAK,EAAE,IAAI,qCAAqC,EAC1D;AAAA,EACC,OAAK,EAAE,OAAO,SAAS;AAAA,EACvB,OAAK,8BAA8B,EAAE,EAAE,2CAA2C,SAAS,EAAE;AAC/F,EACC;AAAA,EACC,MAAM,KAAC,wBAAU,MAAM,SAAM,wBAAU,MAAM,SAAK,wBAAU,SAAS,MAAM;AAAA,EAC3E,MAAM,+BAA+B,MAAM;AAC7C,EACC;AAAA,EACC,MAAM,KAAC,wBAAU,MAAM,SAAM,wBAAU,MAAM,KAAK,SAAS,WAAW;AAAA,EACtE,MAAM,+BAA+B,MAAM,8BAA8B,SAAS,MAAM;AAC1F,EACC,KAAK,+CAA+C;AAEzD,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toMatchJson_exports = {};
20
- __export(toMatchJson_exports, {
21
- MatchesJson: () => MatchesJson,
22
- toMatchJson: () => toMatchJson
23
- });
24
- module.exports = __toCommonJS(toMatchJson_exports);
25
- var import_Match = require("./Match");
26
- var import_Eq = require("../utils/Eq");
27
- var import_Utils = require("../utils/Utils");
28
- const MatchesJson = {
29
- SubjectUndefined: "Subject is undefined.",
30
- SubsetUndefined: "Subset to match with is undefined.",
31
- DoesNotMatch: "Subset does not match subject.",
32
- Yes: "Subset matches subject"
33
- };
34
- const toMatchJson = (value, subset) => (0, import_Match.match)(value).undefined((v) => v, MatchesJson.SubjectUndefined).undefined(() => subset, MatchesJson.SubsetUndefined).not((v) => import_Eq.eq.subset((0, import_Utils.asJson)(v), (0, import_Utils.asJson)(subset)), MatchesJson.DoesNotMatch).else(() => MatchesJson.Yes);
35
- expect.extend({
36
- toMatchJson
37
- });
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- MatchesJson,
41
- toMatchJson
42
- });
43
- //# sourceMappingURL=toMatchJson.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/matchers/toMatchJson.ts"],"sourcesContent":["import { match } from './Match';\nimport { eq } from '../utils/Eq';\nimport { asJson } from '../utils/Utils';\n\nexport const MatchesJson = {\n SubjectUndefined: 'Subject is undefined.',\n SubsetUndefined: 'Subset to match with is undefined.',\n DoesNotMatch: 'Subset does not match subject.',\n Yes: 'Subset matches subject',\n};\n\nexport const toMatchJson = (value?: unknown, subset?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, MatchesJson.SubjectUndefined)\n .undefined(() => subset, MatchesJson.SubsetUndefined)\n .not(v => eq.subset(asJson(v), asJson(subset)), MatchesJson.DoesNotMatch)\n .else(() => MatchesJson.Yes);\n\nexpect.extend({\n toMatchJson: toMatchJson,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchJson(subset?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,gBAAmB;AACnB,mBAAuB;AAEhB,MAAM,cAAc;AAAA,EACzB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,KAAK;AACP;AAEO,MAAM,cAAc,CAAC,OAAiB,eAC3C,oBAAe,KAAK,EACjB,UAAU,OAAK,GAAG,YAAY,gBAAgB,EAC9C,UAAU,MAAM,QAAQ,YAAY,eAAe,EACnD,IAAI,OAAK,aAAG,WAAO,qBAAO,CAAC,OAAG,qBAAO,MAAM,CAAC,GAAG,YAAY,YAAY,EACvE,KAAK,MAAM,YAAY,GAAG;AAE/B,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toMatchRoute_exports = {};
20
- __export(toMatchRoute_exports, {
21
- toMatchRoute: () => toMatchRoute
22
- });
23
- module.exports = __toCommonJS(toMatchRoute_exports);
24
- var import_Match = require("./Match");
25
- var import_Utils = require("../utils/Utils");
26
- const toMatchRoute = (uri, route) => (0, import_Match.match)(uri).undefined((u) => u, "Subject is undefined.").undefined(() => route, "Route to include is undefined.").not(
27
- (u) => (0, import_Utils.asString)(u).includes((0, import_Utils.asString)(route)),
28
- (u) => `Uri '${u}' does not include '${route}'.`
29
- ).else((u) => `Uri '${u}' includes '${route}'`);
30
- expect.extend({
31
- toMatchRoute
32
- });
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- toMatchRoute
36
- });
37
- //# sourceMappingURL=toMatchRoute.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/matchers/toMatchRoute.ts"],"sourcesContent":["import { Uri } from '../utils/Types';\nimport { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchRoute = (uri?: Uri, route?: Uri | string): jest.CustomMatcherResult =>\n match<Uri | undefined>(uri)\n .undefined(u => u, 'Subject is undefined.')\n .undefined(() => route, 'Route to include is undefined.')\n .not(\n u => asString(u).includes(asString(route)),\n u => `Uri '${u}' does not include '${route}'.`\n )\n .else(u => `Uri '${u}' includes '${route}'`);\n\nexpect.extend({\n toMatchRoute: toMatchRoute,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchRoute(route?: Uri | string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsB;AACtB,mBAAyB;AAElB,MAAM,eAAe,CAAC,KAAW,cACtC,oBAAuB,GAAG,EACvB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,OAAO,gCAAgC,EACvD;AAAA,EACC,WAAK,uBAAS,CAAC,EAAE,aAAS,uBAAS,KAAK,CAAC;AAAA,EACzC,OAAK,QAAQ,CAAC,uBAAuB,KAAK;AAC5C,EACC,KAAK,OAAK,QAAQ,CAAC,eAAe,KAAK,GAAG;AAE/C,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toMatchText_exports = {};
20
- __export(toMatchText_exports, {
21
- toMatchText: () => toMatchText
22
- });
23
- module.exports = __toCommonJS(toMatchText_exports);
24
- var import_Match = require("./Match");
25
- var import_Utils = require("../utils/Utils");
26
- const toMatchText = (value, text) => (0, import_Match.match)(value).undefined((v) => v, "Subject is undefined.").undefined(() => text, "Text to match with is undefined.").not(
27
- (v) => (0, import_Utils.asString)(v) === (0, import_Utils.asString)(text),
28
- (v) => `Text '${v}' does not match with text '${text}'.`
29
- ).else((v) => `Text '${v}' matches`);
30
- expect.extend({
31
- toMatchText
32
- });
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- toMatchText
36
- });
37
- //# sourceMappingURL=toMatchText.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/matchers/toMatchText.ts"],"sourcesContent":["import { match } from './Match';\nimport { asString } from '../utils/Utils';\n\nexport const toMatchText = (value?: unknown, text?: unknown): jest.CustomMatcherResult =>\n match<unknown>(value)\n .undefined(v => v, 'Subject is undefined.')\n .undefined(() => text, 'Text to match with is undefined.')\n .not(\n v => asString(v) === asString(text),\n v => `Text '${v}' does not match with text '${text}'.`\n )\n .else(v => `Text '${v}' matches`);\n\nexpect.extend({\n toMatchText: toMatchText,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toMatchText(text?: unknown): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,mBAAyB;AAElB,MAAM,cAAc,CAAC,OAAiB,aAC3C,oBAAe,KAAK,EACjB,UAAU,OAAK,GAAG,uBAAuB,EACzC,UAAU,MAAM,MAAM,kCAAkC,EACxD;AAAA,EACC,WAAK,uBAAS,CAAC,UAAM,uBAAS,IAAI;AAAA,EAClC,OAAK,SAAS,CAAC,+BAA+B,IAAI;AACpD,EACC,KAAK,OAAK,SAAS,CAAC,WAAW;AAEpC,OAAO,OAAO;AAAA,EACZ;AACF,CAAC;","names":[]}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var toPassMatcher_exports = {};
20
- __export(toPassMatcher_exports, {
21
- Passes: () => Passes,
22
- PassesWith: () => PassesWith,
23
- toPassMatcher: () => toPassMatcher,
24
- toPassMatcherWith: () => toPassMatcherWith
25
- });
26
- module.exports = __toCommonJS(toPassMatcher_exports);
27
- var import_Match = require("./Match");
28
- var import_Types = require("../utils/Types");
29
- const Passes = {
30
- Yes: "Match passes, instead of fails.",
31
- No: (reason) => `Match doesn't pass, because '${reason}'`
32
- };
33
- const PassesWith = {
34
- Yes: "Match passes with correct message.",
35
- No: (message, instead) => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`
36
- };
37
- const toPassMatcher = (result) => (0, import_Match.match)(result).not(
38
- (c) => c.pass,
39
- (c) => Passes.No(c.message())
40
- ).else(Passes.Yes);
41
- const toPassMatcherWith = (result, message) => (0, import_Match.match)(result).not(
42
- (c) => c.pass,
43
- (c) => Passes.No(c.message())
44
- ).not(
45
- (c) => c.message().includes((0, import_Types.toMessage)(message)),
46
- (c) => PassesWith.No((0, import_Types.toMessage)(message), c.message())
47
- ).else(PassesWith.Yes);
48
- expect.extend({
49
- toPassMatcher,
50
- toPassMatcherWith
51
- });
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- Passes,
55
- PassesWith,
56
- toPassMatcher,
57
- toPassMatcherWith
58
- });
59
- //# sourceMappingURL=toPassMatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/matchers/toPassMatcher.ts"],"sourcesContent":["import { match } from './Match';\n\nimport { Message, toMessage } from '../utils/Types';\n\n// Handles CustomMatcherResult validations.\n\nexport const Passes = {\n Yes: 'Match passes, instead of fails.',\n No: (reason: string): string => `Match doesn't pass, because '${reason}'`,\n};\n\nexport const PassesWith = {\n Yes: 'Match passes with correct message.',\n No: (message: string, instead: string): string => `Match does pass, however not with message '${message}', but with message '${instead}' instead.`,\n};\n\nexport const toPassMatcher = (result: jest.CustomMatcherResult): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => c.pass,\n c => Passes.No(c.message())\n )\n .else(Passes.Yes);\n\nexport const toPassMatcherWith = (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>): jest.CustomMatcherResult =>\n match(result)\n .not(\n c => c.pass,\n c => Passes.No(c.message())\n )\n .not(\n c => c.message().includes(toMessage(message)),\n c => PassesWith.No(toMessage(message), c.message())\n )\n .else(PassesWith.Yes);\n\nexpect.extend({\n toPassMatcher: toPassMatcher,\n toPassMatcherWith: toPassMatcherWith,\n});\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace jest {\n interface Matchers<R, T> {\n toPassMatcher(): R;\n toPassMatcherWith(message: string): R;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AAEtB,mBAAmC;AAI5B,MAAM,SAAS;AAAA,EACpB,KAAK;AAAA,EACL,IAAI,CAAC,WAA2B,gCAAgC,MAAM;AACxE;AAEO,MAAM,aAAa;AAAA,EACxB,KAAK;AAAA,EACL,IAAI,CAAC,SAAiB,YAA4B,8CAA8C,OAAO,wBAAwB,OAAO;AACxI;AAEO,MAAM,gBAAgB,CAAC,eAC5B,oBAAM,MAAM,EACT;AAAA,EACC,OAAK,EAAE;AAAA,EACP,OAAK,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC5B,EACC,KAAK,OAAO,GAAG;AAEb,MAAM,oBAAoB,CAAC,QAAkC,gBAClE,oBAAM,MAAM,EACT;AAAA,EACC,OAAK,EAAE;AAAA,EACP,OAAK,OAAO,GAAG,EAAE,QAAQ,CAAC;AAC5B,EACC;AAAA,EACC,OAAK,EAAE,QAAQ,EAAE,aAAS,wBAAU,OAAO,CAAC;AAAA,EAC5C,OAAK,WAAW,OAAG,wBAAU,OAAO,GAAG,EAAE,QAAQ,CAAC;AACpD,EACC,KAAK,WAAW,GAAG;AAExB,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AACF,CAAC;","names":[]}
package/dist/mock/Fits.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var Fits_exports = {};
20
- __export(Fits_exports, {
21
- ObjectContainingJson: () => ObjectContainingJson,
22
- ObjectContainingText: () => ObjectContainingText,
23
- ObjectContainingTextExact: () => ObjectContainingTextExact,
24
- fits: () => fits
25
- });
26
- module.exports = __toCommonJS(Fits_exports);
27
- var import_Utils = require("../utils/Utils");
28
- var import_Eq = require("../utils/Eq");
29
- var import_expect = require("expect");
30
- class ObjectContainingText extends import_expect.AsymmetricMatcher {
31
- asymmetricMatch(other) {
32
- return (0, import_Utils.asString)(other).includes((0, import_Utils.asString)(this.sample));
33
- }
34
- toString() {
35
- return `String${this.inverse ? "Not" : ""}Containing`;
36
- }
37
- }
38
- class ObjectContainingTextExact extends import_expect.AsymmetricMatcher {
39
- asymmetricMatch(other) {
40
- return (0, import_Utils.asString)(other) === (0, import_Utils.asString)(this.sample);
41
- }
42
- toString() {
43
- return `String${this.inverse ? "Not" : ""}Containing`;
44
- }
45
- }
46
- class ObjectContainingJson extends import_expect.AsymmetricMatcher {
47
- asymmetricMatch(other) {
48
- return import_Eq.eq.subset((0, import_Utils.asJson)(other), (0, import_Utils.asJson)(this.sample));
49
- }
50
- toString() {
51
- return `Object${this.inverse ? "Not" : ""}Containing`;
52
- }
53
- }
54
- const fits = {
55
- any: () => expect.anything(),
56
- type: (type) => expect.any(type),
57
- with: (o) => expect.objectContaining(o),
58
- text: (s) => new ObjectContainingText(s),
59
- textExact: (s) => new ObjectContainingTextExact(s),
60
- uri: (u) => fits.textExact(u),
61
- json: (s) => new ObjectContainingJson(s),
62
- items: (...items) => expect.arrayContaining((0, import_Utils.toArray)(...items))
63
- };
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- ObjectContainingJson,
67
- ObjectContainingText,
68
- ObjectContainingTextExact,
69
- fits
70
- });
71
- //# sourceMappingURL=Fits.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/mock/Fits.ts"],"sourcesContent":["import { asJson, asString, toArray } from '../utils/Utils';\nimport { eq } from '../utils/Eq';\nimport { AsymmetricMatcher } from 'expect';\nimport { Uri } from '../utils/Types';\n\nexport class ObjectContainingText extends AsymmetricMatcher<string> {\n asymmetricMatch(other: any) {\n return asString(other).includes(asString(this.sample));\n }\n\n toString() {\n return `String${this.inverse ? 'Not' : ''}Containing`;\n }\n}\n\nexport class ObjectContainingTextExact extends AsymmetricMatcher<string> {\n asymmetricMatch(other: any) {\n return asString(other) === asString(this.sample);\n }\n\n toString() {\n return `String${this.inverse ? 'Not' : ''}Containing`;\n }\n}\n\nexport class ObjectContainingJson extends AsymmetricMatcher<any> {\n asymmetricMatch(other: any) {\n return eq.subset(asJson(other), asJson(this.sample));\n }\n\n toString() {\n return `Object${this.inverse ? 'Not' : ''}Containing`;\n }\n}\n\nexport const fits = {\n any: (): any => expect.anything(),\n type: (type?: unknown): any => expect.any(type),\n with: (o: unknown): any => expect.objectContaining(o),\n text: (s: any): any => new ObjectContainingText(s),\n textExact: (s: any): any => new ObjectContainingTextExact(s),\n uri: (u: Uri): any => fits.textExact(u),\n json: (s: any): any => new ObjectContainingJson(s),\n items: (...items: any[]): any => expect.arrayContaining(toArray(...items)),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0C;AAC1C,gBAAmB;AACnB,oBAAkC;AAG3B,MAAM,6BAA6B,gCAA0B;AAAA,EAClE,gBAAgB,OAAY;AAC1B,eAAO,uBAAS,KAAK,EAAE,aAAS,uBAAS,KAAK,MAAM,CAAC;AAAA,EACvD;AAAA,EAEA,WAAW;AACT,WAAO,SAAS,KAAK,UAAU,QAAQ,EAAE;AAAA,EAC3C;AACF;AAEO,MAAM,kCAAkC,gCAA0B;AAAA,EACvE,gBAAgB,OAAY;AAC1B,eAAO,uBAAS,KAAK,UAAM,uBAAS,KAAK,MAAM;AAAA,EACjD;AAAA,EAEA,WAAW;AACT,WAAO,SAAS,KAAK,UAAU,QAAQ,EAAE;AAAA,EAC3C;AACF;AAEO,MAAM,6BAA6B,gCAAuB;AAAA,EAC/D,gBAAgB,OAAY;AAC1B,WAAO,aAAG,WAAO,qBAAO,KAAK,OAAG,qBAAO,KAAK,MAAM,CAAC;AAAA,EACrD;AAAA,EAEA,WAAW;AACT,WAAO,SAAS,KAAK,UAAU,QAAQ,EAAE;AAAA,EAC3C;AACF;AAEO,MAAM,OAAO;AAAA,EAClB,KAAK,MAAW,OAAO,SAAS;AAAA,EAChC,MAAM,CAAC,SAAwB,OAAO,IAAI,IAAI;AAAA,EAC9C,MAAM,CAAC,MAAoB,OAAO,iBAAiB,CAAC;AAAA,EACpD,MAAM,CAAC,MAAgB,IAAI,qBAAqB,CAAC;AAAA,EACjD,WAAW,CAAC,MAAgB,IAAI,0BAA0B,CAAC;AAAA,EAC3D,KAAK,CAAC,MAAgB,KAAK,UAAU,CAAC;AAAA,EACtC,MAAM,CAAC,MAAgB,IAAI,qBAAqB,CAAC;AAAA,EACjD,OAAO,IAAI,UAAsB,OAAO,oBAAgB,sBAAQ,GAAG,KAAK,CAAC;AAC3E;","names":[]}
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var Mocks_exports = {};
20
- __export(Mocks_exports, {
21
- Mocks: () => Mocks,
22
- mock: () => mock
23
- });
24
- module.exports = __toCommonJS(Mocks_exports);
25
- var import_Req = require("../utils/Req");
26
- class Mocks {
27
- clear = () => jest.clearAllMocks();
28
- impl = (f) => jest.fn().mockImplementation(f);
29
- property = (object, getter, value) => jest.spyOn(object, getter, "get").mockReturnValue(value);
30
- reject = (value) => jest.fn().mockRejectedValue(value);
31
- rejectWith = (props = {}) => jest.fn().mockRejectedValue(mock.a(props));
32
- req = {
33
- id: (id) => new import_Req.Req({ id }),
34
- q: (q) => new import_Req.Req({ q }),
35
- with: (a) => new import_Req.Req(a),
36
- body: (body) => new import_Req.Req({ body }),
37
- path: (path) => new import_Req.Req({ path }),
38
- query: (query) => new import_Req.Req({ query })
39
- };
40
- resp = {
41
- items: (status, items = []) => ({
42
- status,
43
- body: {
44
- data: {
45
- code: status.id,
46
- itemCount: items.length,
47
- items
48
- }
49
- }
50
- }),
51
- errors: (status, message, errors = []) => ({
52
- status,
53
- body: {
54
- error: {
55
- code: status.id,
56
- message,
57
- errorCount: errors.length,
58
- errors
59
- }
60
- }
61
- })
62
- };
63
- resolve = (value) => jest.fn().mockResolvedValue(value);
64
- resolveWith = (props = {}) => jest.fn().mockResolvedValue(mock.a(props));
65
- return = (value) => jest.fn().mockReturnValue(value);
66
- returnWith = (props = {}) => jest.fn().mockReturnValue(mock.a(props));
67
- this = () => jest.fn().mockReturnThis();
68
- provider = {
69
- data: (...items) => ({
70
- execute: jest.fn().mockResolvedValue({
71
- body: {
72
- data: {
73
- itemCount: items.length,
74
- items
75
- }
76
- }
77
- })
78
- })
79
- };
80
- empty = (props = {}) => props;
81
- a = this.empty;
82
- an = this.empty;
83
- date = (epoch = 1621347575) => {
84
- const date = new Date(epoch);
85
- date.toString = mock.return("Mon Jan 19 1970 19:22:27 GMT+0100 (Central European Standard Time)");
86
- date.toLocaleDateString = mock.return("19/01/1970");
87
- date.toDateString = mock.return("19/01/1970");
88
- return date;
89
- };
90
- once = (...values) => values.reduce((m, v) => m.mockImplementationOnce(() => v), jest.fn());
91
- }
92
- const mock = new Mocks();
93
- // Annotate the CommonJS export names for ESM import in node:
94
- 0 && (module.exports = {
95
- Mocks,
96
- mock
97
- });
98
- //# sourceMappingURL=Mocks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/mock/Mocks.ts"],"sourcesContent":["import { Id, Json } from '../utils/Types';\nimport { Req } from '../utils/Req';\nimport { HttpStatus, Response } from '../utils/Response';\n\nexport class Mocks {\n clear = (): typeof jest => jest.clearAllMocks();\n impl = (f?: (...args: any[]) => any): jest.Mock => jest.fn().mockImplementation(f);\n property = <T extends object, P extends jest.NonFunctionPropertyNames<Required<T>>>(object: T, getter: P, value: T[P]): jest.SpyInstance =>\n jest.spyOn(object, getter, 'get' as jest.PropertyAccessors<P, T>).mockReturnValue(value as any);\n reject = (value?: unknown): jest.Mock => jest.fn().mockRejectedValue(value);\n rejectWith = <T = any>(props: Partial<T> = {}): jest.Mock => jest.fn().mockRejectedValue(mock.a(props));\n req = {\n id: (id: Id): Req => new Req({ id }),\n q: (q: unknown): Req => new Req({ q }),\n with: (a: Json): Req => new Req(a),\n body: (body: unknown): Req => new Req({ body }),\n path: (path: Json): Req => new Req({ path }),\n query: (query: Json): Req => new Req({ query }),\n };\n resp = {\n items: (status: HttpStatus, items: unknown[] = []): Response => ({\n status: status,\n body: {\n data: {\n code: status.id as number,\n itemCount: items.length,\n items,\n },\n },\n }),\n errors: (status: HttpStatus, message: string, errors: unknown[] = []): Response => ({\n status: status,\n body: {\n error: {\n code: status.id as number,\n message: message,\n errorCount: errors.length,\n errors,\n },\n },\n }),\n };\n resolve = (value?: unknown): jest.Mock => jest.fn().mockResolvedValue(value);\n resolveWith = <T = any>(props: Partial<T> = {}): jest.Mock => jest.fn().mockResolvedValue(mock.a(props));\n return = (value?: unknown): jest.Mock => jest.fn().mockReturnValue(value);\n returnWith = <T = any>(props: Partial<T> = {}): jest.Mock => jest.fn().mockReturnValue(mock.a(props));\n this = (): jest.Mock => jest.fn().mockReturnThis();\n provider = {\n data: (...items: any[]): { execute: jest.Mock } => ({\n execute: jest.fn().mockResolvedValue({\n body: {\n data: {\n itemCount: items.length,\n items,\n },\n },\n }),\n }),\n };\n empty = <T = any>(props: Partial<T> = {}): T => props as T;\n a = this.empty;\n an = this.empty;\n date = (epoch = 1621347575): Date => {\n const date = new Date(epoch);\n date.toString = mock.return('Mon Jan 19 1970 19:22:27 GMT+0100 (Central European Standard Time)');\n date.toLocaleDateString = mock.return('19/01/1970');\n date.toDateString = mock.return('19/01/1970');\n return date;\n };\n once = (...values: unknown[]): jest.Mock => values.reduce((m: jest.Mock, v: unknown) => m.mockImplementationOnce(() => v), jest.fn());\n}\n\nexport const mock = new Mocks();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAoB;AAGb,MAAM,MAAM;AAAA,EACjB,QAAQ,MAAmB,KAAK,cAAc;AAAA,EAC9C,OAAO,CAAC,MAA2C,KAAK,GAAG,EAAE,mBAAmB,CAAC;AAAA,EACjF,WAAW,CAAyE,QAAW,QAAW,UACxG,KAAK,MAAM,QAAQ,QAAQ,KAAqC,EAAE,gBAAgB,KAAY;AAAA,EAChG,SAAS,CAAC,UAA+B,KAAK,GAAG,EAAE,kBAAkB,KAAK;AAAA,EAC1E,aAAa,CAAU,QAAoB,CAAC,MAAiB,KAAK,GAAG,EAAE,kBAAkB,KAAK,EAAE,KAAK,CAAC;AAAA,EACtG,MAAM;AAAA,IACJ,IAAI,CAAC,OAAgB,IAAI,eAAI,EAAE,GAAG,CAAC;AAAA,IACnC,GAAG,CAAC,MAAoB,IAAI,eAAI,EAAE,EAAE,CAAC;AAAA,IACrC,MAAM,CAAC,MAAiB,IAAI,eAAI,CAAC;AAAA,IACjC,MAAM,CAAC,SAAuB,IAAI,eAAI,EAAE,KAAK,CAAC;AAAA,IAC9C,MAAM,CAAC,SAAoB,IAAI,eAAI,EAAE,KAAK,CAAC;AAAA,IAC3C,OAAO,CAAC,UAAqB,IAAI,eAAI,EAAE,MAAM,CAAC;AAAA,EAChD;AAAA,EACA,OAAO;AAAA,IACL,OAAO,CAAC,QAAoB,QAAmB,CAAC,OAAiB;AAAA,MAC/D;AAAA,MACA,MAAM;AAAA,QACJ,MAAM;AAAA,UACJ,MAAM,OAAO;AAAA,UACb,WAAW,MAAM;AAAA,UACjB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,QAAQ,CAAC,QAAoB,SAAiB,SAAoB,CAAC,OAAiB;AAAA,MAClF;AAAA,MACA,MAAM;AAAA,QACJ,OAAO;AAAA,UACL,MAAM,OAAO;AAAA,UACb;AAAA,UACA,YAAY,OAAO;AAAA,UACnB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU,CAAC,UAA+B,KAAK,GAAG,EAAE,kBAAkB,KAAK;AAAA,EAC3E,cAAc,CAAU,QAAoB,CAAC,MAAiB,KAAK,GAAG,EAAE,kBAAkB,KAAK,EAAE,KAAK,CAAC;AAAA,EACvG,SAAS,CAAC,UAA+B,KAAK,GAAG,EAAE,gBAAgB,KAAK;AAAA,EACxE,aAAa,CAAU,QAAoB,CAAC,MAAiB,KAAK,GAAG,EAAE,gBAAgB,KAAK,EAAE,KAAK,CAAC;AAAA,EACpG,OAAO,MAAiB,KAAK,GAAG,EAAE,eAAe;AAAA,EACjD,WAAW;AAAA,IACT,MAAM,IAAI,WAA0C;AAAA,MAClD,SAAS,KAAK,GAAG,EAAE,kBAAkB;AAAA,QACnC,MAAM;AAAA,UACJ,MAAM;AAAA,YACJ,WAAW,MAAM;AAAA,YACjB;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EACA,QAAQ,CAAU,QAAoB,CAAC,MAAS;AAAA,EAChD,IAAI,KAAK;AAAA,EACT,KAAK,KAAK;AAAA,EACV,OAAO,CAAC,QAAQ,eAAqB;AACnC,UAAM,OAAO,IAAI,KAAK,KAAK;AAC3B,SAAK,WAAW,KAAK,OAAO,oEAAoE;AAChG,SAAK,qBAAqB,KAAK,OAAO,YAAY;AAClD,SAAK,eAAe,KAAK,OAAO,YAAY;AAC5C,WAAO;AAAA,EACT;AAAA,EACA,OAAO,IAAI,WAAiC,OAAO,OAAO,CAAC,GAAc,MAAe,EAAE,uBAAuB,MAAM,CAAC,GAAG,KAAK,GAAG,CAAC;AACtI;AAEO,MAAM,OAAO,IAAI,MAAM;","names":[]}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var mock_exports = {};
17
- module.exports = __toCommonJS(mock_exports);
18
- __reExport(mock_exports, require("./Fits"), module.exports);
19
- __reExport(mock_exports, require("./Mocks"), module.exports);
20
- // Annotate the CommonJS export names for ESM import in node:
21
- 0 && (module.exports = {
22
- ...require("./Fits"),
23
- ...require("./Mocks")
24
- });
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/mock/index.ts"],"sourcesContent":["export * from './Fits';\nexport * from './Mocks';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,mBAAd;AACA,yBAAc,oBADd;","names":[]}