@thisisagile/easy-test 21.2.0 → 21.2.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 (57) hide show
  1. package/dist/matchers/Check.d.ts +0 -2
  2. package/dist/matchers/Check.js +1 -2
  3. package/dist/matchers/HttpMatchers.d.ts +0 -2
  4. package/dist/matchers/HttpMatchers.js +1 -2
  5. package/dist/matchers/Match.d.ts +0 -2
  6. package/dist/matchers/Match.js +1 -2
  7. package/dist/matchers/Match.js.map +1 -1
  8. package/dist/matchers/ResultMatchers.d.ts +0 -2
  9. package/dist/matchers/ResultMatchers.js +1 -2
  10. package/dist/matchers/index.js +1 -1
  11. package/dist/matchers/toBeArrayOf.d.ts +0 -2
  12. package/dist/matchers/toBeArrayOf.js +1 -2
  13. package/dist/matchers/toBeArrayOfWithLength.d.ts +0 -2
  14. package/dist/matchers/toBeArrayOfWithLength.js +1 -2
  15. package/dist/matchers/toBeAt.d.ts +0 -2
  16. package/dist/matchers/toBeAt.js +1 -2
  17. package/dist/matchers/toBeExactlyAt.d.ts +0 -2
  18. package/dist/matchers/toBeExactlyAt.js +1 -2
  19. package/dist/matchers/toBeQueriedWith.d.ts +0 -2
  20. package/dist/matchers/toBeQueriedWith.js +1 -2
  21. package/dist/matchers/toBeRoutedTo.d.ts +0 -2
  22. package/dist/matchers/toBeRoutedTo.js +2 -3
  23. package/dist/matchers/toBeValid.d.ts +0 -2
  24. package/dist/matchers/toBeValid.js +1 -2
  25. package/dist/matchers/toFailMatcher.d.ts +0 -2
  26. package/dist/matchers/toFailMatcher.js +2 -3
  27. package/dist/matchers/toMatchArray.d.ts +0 -2
  28. package/dist/matchers/toMatchArray.js +1 -2
  29. package/dist/matchers/toMatchExactJson.d.ts +0 -2
  30. package/dist/matchers/toMatchExactJson.js +1 -2
  31. package/dist/matchers/toMatchException.d.ts +0 -2
  32. package/dist/matchers/toMatchException.js +2 -3
  33. package/dist/matchers/toMatchJson.d.ts +0 -2
  34. package/dist/matchers/toMatchJson.js +2 -3
  35. package/dist/matchers/toMatchRoute.d.ts +0 -2
  36. package/dist/matchers/toMatchRoute.js +2 -3
  37. package/dist/matchers/toMatchText.d.ts +0 -2
  38. package/dist/matchers/toMatchText.js +2 -3
  39. package/dist/matchers/toPassMatcher.d.ts +0 -2
  40. package/dist/matchers/toPassMatcher.js +2 -3
  41. package/dist/mock/Fits.d.ts +0 -2
  42. package/dist/mock/Fits.js +2 -3
  43. package/dist/mock/Fits.js.map +1 -1
  44. package/dist/mock/Mocks.d.ts +1 -3
  45. package/dist/mock/Mocks.js +1 -2
  46. package/dist/utils/Eq.d.ts +0 -2
  47. package/dist/utils/Eq.js +1 -2
  48. package/dist/utils/Req.d.ts +0 -2
  49. package/dist/utils/Req.js +1 -2
  50. package/dist/utils/Response.d.ts +0 -2
  51. package/dist/utils/Types.d.ts +0 -2
  52. package/dist/utils/Types.js +1 -2
  53. package/dist/utils/Utils.d.ts +0 -2
  54. package/dist/utils/Utils.js +1 -2
  55. package/package.json +7 -7
  56. package/src/matchers/Match.ts +5 -2
  57. package/src/mock/Fits.ts +2 -1
@@ -1,4 +1,3 @@
1
- //#region src/matchers/Check.d.ts
2
1
  type ToMessage<S> = string | ((s: S[]) => string);
3
2
  declare class Check<S> {
4
3
  private ctx;
@@ -14,6 +13,5 @@ declare class Check<S> {
14
13
  }
15
14
  export declare const check: <S>(ctx: jest.MatcherContext, received: S, expected?: S) => Check<S>;
16
15
  export declare const checkDefined: <S>(ctx: jest.MatcherContext, received: S, expected?: S) => Check<S>;
17
- //#endregion
18
16
  export {};
19
17
  //# sourceMappingURL=Check.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { isDefined } from "../utils/Utils.js";
2
- //#region src/matchers/Check.ts
2
+ // src/matchers/Check.ts
3
3
  var Check = class Check {
4
4
  ctx;
5
5
  received;
@@ -36,7 +36,6 @@ var Check = class Check {
36
36
  };
37
37
  const check = (ctx, received, expected) => new Check(ctx, received, expected);
38
38
  const checkDefined = (ctx, received, expected) => new Check(ctx, received, expected).undefined(([r]) => r, "Received array is undefined.").undefined(([, e]) => e, "Expected array is undefined.");
39
- //#endregion
40
39
  export { check, checkDefined };
41
40
 
42
41
  //# sourceMappingURL=Check.js.map
@@ -1,5 +1,4 @@
1
1
  import { Response } from "../utils/Response.js";
2
- //#region src/matchers/HttpMatchers.d.ts
3
2
  export declare const toHaveStatus: (res: Response, code: number) => jest.CustomMatcherResult;
4
3
  export declare const toBeOk: (res: Response) => jest.CustomMatcherResult;
5
4
  export declare const toBeCreated: (res: Response) => jest.CustomMatcherResult;
@@ -30,5 +29,4 @@ declare global {
30
29
  }
31
30
  }
32
31
  }
33
- //#endregion
34
32
  //# sourceMappingURL=HttpMatchers.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { match } from "./Match.js";
2
- //#region src/matchers/HttpMatchers.ts
2
+ // src/matchers/HttpMatchers.ts
3
3
  const toHaveStatus = (res, code) => match(res).undefined((r) => r, "Response is unknown.").undefined((r) => r?.status?.id, () => "Response does not have a status code").not((r) => r.status.id === code, (r) => `Response does not have code '${code}', but has code '${r.status.id}' instead.`).else(`Response does have status code '${code}'.`);
4
4
  const toBeOk = (res) => toHaveStatus(res, 200);
5
5
  const toBeCreated = (res) => toHaveStatus(res, 201);
@@ -26,7 +26,6 @@ expect.extend({
26
26
  toHaveStatus,
27
27
  toBeBadGateway
28
28
  });
29
- //#endregion
30
29
  export { toBeBadGateway, toBeBadRequest, toBeConflict, toBeCreated, toBeForbidden, toBeInternalServerError, toBeNotFound, toBeOk, toBeOkWithItems, toBeUnauthorized, toHaveNoContent, toHaveStatus };
31
30
 
32
31
  //# sourceMappingURL=HttpMatchers.js.map
@@ -1,5 +1,4 @@
1
1
  import { Message } from "../utils/Types.js";
2
- //#region src/matchers/Match.d.ts
3
2
  export declare class Match<S> {
4
3
  private readonly subject;
5
4
  private readonly failed;
@@ -10,5 +9,4 @@ export declare class Match<S> {
10
9
  else(message: Message<S>): jest.CustomMatcherResult;
11
10
  }
12
11
  export declare const match: <S>(subject: S) => Match<S>;
13
- //#endregion
14
12
  //# sourceMappingURL=Match.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { isDefined } from "../utils/Utils.js";
2
2
  import { toMessage } from "../utils/Types.js";
3
- //#region src/matchers/Match.ts
3
+ // src/matchers/Match.ts
4
4
  var Match = class Match {
5
5
  subject;
6
6
  failed;
@@ -29,7 +29,6 @@ var Match = class Match {
29
29
  }
30
30
  };
31
31
  const match = (subject) => new Match(subject);
32
- //#endregion
33
32
  export { Match, match };
34
33
 
35
34
  //# sourceMappingURL=Match.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Match.js","names":[],"sources":["../../src/matchers/Match.ts"],"sourcesContent":["import { isDefined } from '../utils/Utils';\nimport { Message, toMessage } from '../utils/Types';\n\nexport class Match<S> {\n constructor(private readonly subject: S, private readonly failed = false, private readonly message: Message<S> = '') {}\n\n not(p: (s: S) => boolean, message: Message<S>): Match<S> {\n if (this.failed) {\n return this;\n }\n try {\n return new Match<S>(this.subject, !p(this.subject), toMessage(message, this.subject));\n } catch (e: any) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n return new Match<S>(this.subject, true, e.message);\n }\n }\n\n undefined(p: (s: S) => any, message: Message<S>): Match<S> {\n return this.not(() => isDefined(p(this.subject)), message);\n }\n\n else(message: Message<S>): jest.CustomMatcherResult {\n return {\n pass: !this.failed,\n message: () => (this.failed ? toMessage(this.message) : `${toMessage(message, this.subject)}, which we did not expect.`),\n };\n }\n}\n\nexport const match = <S>(subject: S): Match<S> => new Match<S>(subject);\n"],"mappings":";;;AAGA,IAAa,QAAb,MAAa,MAAS;CACS;CAA6B;CAAiC;CAA3F,YAAY,SAA6B,SAA0B,OAAO,UAAuC,IAAI;EAAxF,KAAA,UAAA;EAA6B,KAAA,SAAA;EAAiC,KAAA,UAAA;CAA2B;CAEtH,IAAI,GAAsB,SAA+B;EACvD,IAAI,KAAK,QACP,OAAO;EAET,IAAI;GACF,OAAO,IAAI,MAAS,KAAK,SAAS,CAAC,EAAE,KAAK,OAAO,GAAG,UAAU,SAAS,KAAK,OAAO,CAAC;EACtF,SAAS,GAAQ;GAEf,OAAO,IAAI,MAAS,KAAK,SAAS,MAAM,EAAE,OAAO;EACnD;CACF;CAEA,UAAU,GAAkB,SAA+B;EACzD,OAAO,KAAK,UAAU,UAAU,EAAE,KAAK,OAAO,CAAC,GAAG,OAAO;CAC3D;CAEA,KAAK,SAA+C;EAClD,OAAO;GACL,MAAM,CAAC,KAAK;GACZ,eAAgB,KAAK,SAAS,UAAU,KAAK,OAAO,IAAI,GAAG,UAAU,SAAS,KAAK,OAAO,EAAE;EAC9F;CACF;AACF;AAEA,MAAa,SAAY,YAAyB,IAAI,MAAS,OAAO"}
1
+ {"version":3,"file":"Match.js","names":[],"sources":["../../src/matchers/Match.ts"],"sourcesContent":["import { isDefined } from '../utils/Utils';\nimport { Message, toMessage } from '../utils/Types';\n\nexport class Match<S> {\n constructor(\n private readonly subject: S,\n private readonly failed = false,\n private readonly message: Message<S> = ''\n ) {}\n\n not(p: (s: S) => boolean, message: Message<S>): Match<S> {\n if (this.failed) {\n return this;\n }\n try {\n return new Match<S>(this.subject, !p(this.subject), toMessage(message, this.subject));\n } catch (e: any) {\n return new Match<S>(this.subject, true, e.message);\n }\n }\n\n undefined(p: (s: S) => any, message: Message<S>): Match<S> {\n return this.not(() => isDefined(p(this.subject)), message);\n }\n\n else(message: Message<S>): jest.CustomMatcherResult {\n return {\n pass: !this.failed,\n message: () => (this.failed ? toMessage(this.message) : `${toMessage(message, this.subject)}, which we did not expect.`),\n };\n }\n}\n\nexport const match = <S>(subject: S): Match<S> => new Match<S>(subject);\n"],"mappings":";;;AAGA,IAAa,QAAb,MAAa,MAAS;CAED;CACA;CACA;CAHnB,YACE,SACA,SAA0B,OAC1B,UAAuC,IACvC;EAHiB,KAAA,UAAA;EACA,KAAA,SAAA;EACA,KAAA,UAAA;CAChB;CAEH,IAAI,GAAsB,SAA+B;EACvD,IAAI,KAAK,QACP,OAAO;EAET,IAAI;GACF,OAAO,IAAI,MAAS,KAAK,SAAS,CAAC,EAAE,KAAK,OAAO,GAAG,UAAU,SAAS,KAAK,OAAO,CAAC;EACtF,SAAS,GAAQ;GACf,OAAO,IAAI,MAAS,KAAK,SAAS,MAAM,EAAE,OAAO;EACnD;CACF;CAEA,UAAU,GAAkB,SAA+B;EACzD,OAAO,KAAK,UAAU,UAAU,EAAE,KAAK,OAAO,CAAC,GAAG,OAAO;CAC3D;CAEA,KAAK,SAA+C;EAClD,OAAO;GACL,MAAM,CAAC,KAAK;GACZ,eAAgB,KAAK,SAAS,UAAU,KAAK,OAAO,IAAI,GAAG,UAAU,SAAS,KAAK,OAAO,EAAE;EAC9F;CACF;AACF;AAEA,MAAa,SAAY,YAAyB,IAAI,MAAS,OAAO"}
@@ -1,5 +1,4 @@
1
1
  import { Results } from "../utils/Types.js";
2
- //#region src/matchers/ResultMatchers.d.ts
3
2
  export declare const toResultWith: (results: Results, message: string) => jest.CustomMatcherResult;
4
3
  export declare const toFail: (results: Results) => jest.CustomMatcherResult;
5
4
  export declare const toFailWith: (results: Results, message: string) => jest.CustomMatcherResult;
@@ -12,5 +11,4 @@ declare global {
12
11
  }
13
12
  }
14
13
  }
15
- //#endregion
16
14
  //# sourceMappingURL=ResultMatchers.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { match } from "./Match.js";
2
- //#region src/matchers/ResultMatchers.ts
2
+ // src/matchers/ResultMatchers.ts
3
3
  const notDefined = "Results is not defined.";
4
4
  const doesNotFail = "Results does not fail.";
5
5
  const hasMessage = (res, message) => res.results.some((r) => r.message === message);
@@ -12,7 +12,6 @@ expect.extend({
12
12
  toFail,
13
13
  toFailWith
14
14
  });
15
- //#endregion
16
15
  export { toFail, toFailWith, toResultWith };
17
16
 
18
17
  //# sourceMappingURL=ResultMatchers.js.map
@@ -1,5 +1,5 @@
1
- import { Match, match } from "./Match.js";
2
1
  import { toBeBadGateway, toBeBadRequest, toBeConflict, toBeCreated, toBeForbidden, toBeInternalServerError, toBeNotFound, toBeOk, toBeOkWithItems, toBeUnauthorized, toHaveNoContent, toHaveStatus } from "./HttpMatchers.js";
2
+ import { Match, match } from "./Match.js";
3
3
  import { check, checkDefined } from "./Check.js";
4
4
  import { toFail, toFailWith, toResultWith } from "./ResultMatchers.js";
5
5
  import { toBeArrayOf } from "./toBeArrayOf.js";
@@ -1,5 +1,4 @@
1
1
  import { Constructor } from "../utils/Types.js";
2
- //#region src/matchers/toBeArrayOf.d.ts
3
2
  export declare const toBeArrayOf: <T>(items: unknown, ctor: Constructor<T>) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toBeArrayOf.d.ts.map
@@ -1,8 +1,7 @@
1
1
  import { match } from "./Match.js";
2
- //#region src/matchers/toBeArrayOf.ts
2
+ // src/matchers/toBeArrayOf.ts
3
3
  const 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}'`);
4
4
  expect.extend({ toBeArrayOf });
5
- //#endregion
6
5
  export { toBeArrayOf };
7
6
 
8
7
  //# sourceMappingURL=toBeArrayOf.js.map
@@ -1,5 +1,4 @@
1
1
  import { Constructor } from "../utils/Types.js";
2
- //#region src/matchers/toBeArrayOfWithLength.d.ts
3
2
  export declare const toBeArrayOfWithLength: <T>(items: unknown, ctor: Constructor<T>, length: number) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toBeArrayOfWithLength.d.ts.map
@@ -1,8 +1,7 @@
1
1
  import { match } from "./Match.js";
2
- //#region src/matchers/toBeArrayOfWithLength.ts
2
+ // src/matchers/toBeArrayOfWithLength.ts
3
3
  const toBeArrayOfWithLength = (items, ctor, length) => match(items).undefined((it) => it, "Subject is undefined.").not((it) => it instanceof Array, "Subject is not an array.").not((it) => it.length === length, (it) => `Subject does not have ${length} elements, but ${it.length}.`).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}'`);
4
4
  expect.extend({ toBeArrayOfWithLength });
5
- //#endregion
6
5
  export { toBeArrayOfWithLength };
7
6
 
8
7
  //# sourceMappingURL=toBeArrayOfWithLength.js.map
@@ -1,5 +1,4 @@
1
1
  import { Id, Tester, UseCase } from "../utils/Types.js";
2
- //#region src/matchers/toBeAt.d.ts
3
2
  export declare const toBeAt: (tester?: Tester, uc?: UseCase, id?: Id) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toBeAt.d.ts.map
@@ -1,10 +1,9 @@
1
1
  import { match } from "./Match.js";
2
- //#region src/matchers/toBeAt.ts
2
+ // src/matchers/toBeAt.ts
3
3
  const toBeAt = (tester, uc, id) => {
4
4
  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((t) => t.url.includes(`/${uc?.app.id}`), (t) => `We expected the tester to be at app '${uc?.app.id}', but it is at '${t?.url}' instead.`).not((t) => t.url.includes(`/${uc?.id}`), (t) => `We expected the tester to be at use case '${uc?.id}', but it is at '${t?.url}' instead.`).not((t) => t.url.includes(id ? `/${id}` : ""), (t) => `We expected the path to contain '/42', but it is '${t?.url}' instead.`).else((t) => `The tester is at '${t?.url}'`);
5
5
  };
6
6
  expect.extend({ toBeAt });
7
- //#endregion
8
7
  export { toBeAt };
9
8
 
10
9
  //# sourceMappingURL=toBeAt.js.map
@@ -1,5 +1,4 @@
1
1
  import { Id, Tester, UseCase } from "../utils/Types.js";
2
- //#region src/matchers/toBeExactlyAt.d.ts
3
2
  export declare const toBeExactlyAt: (tester?: Tester, uc?: UseCase, id?: Id) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toBeExactlyAt.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { isDefined } from "../utils/Utils.js";
2
2
  import { match } from "./Match.js";
3
- //#region src/matchers/toBeExactlyAt.ts
3
+ // src/matchers/toBeExactlyAt.ts
4
4
  const toUrl = (uc, id) => {
5
5
  const i = isDefined(id) ? `/${id}` : "";
6
6
  return `/${uc.app.id}/${uc.id}${i}`;
@@ -9,7 +9,6 @@ const toBeExactlyAt = (tester, uc, id) => {
9
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((t) => t.url.includes(toUrl(uc, id)), (t) => `We expected the tester to be at: '${toUrl(uc, id)}', but it is at: '${t?.url}' instead.`).else((t) => `The tester is at '${t?.url}'`);
10
10
  };
11
11
  expect.extend({ toBeExactlyAt });
12
- //#endregion
13
12
  export { toBeExactlyAt };
14
13
 
15
14
  //# sourceMappingURL=toBeExactlyAt.js.map
@@ -1,5 +1,4 @@
1
1
  import { Query } from "../utils/Types.js";
2
- //#region src/matchers/toBeQueriedWith.d.ts
3
2
  export declare const toBeQueriedWith: (query: jest.Mock, expected: Query) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toBeQueriedWith.d.ts.map
@@ -1,8 +1,7 @@
1
1
  import { match } from "./Match.js";
2
- //#region src/matchers/toBeQueriedWith.ts
2
+ // src/matchers/toBeQueriedWith.ts
3
3
  const toBeQueriedWith = (query, expected) => match(query?.mock?.calls).undefined((c) => c, "Query is unknown.").not((c) => c.length === 1, "Query did not execute.").not((c) => c[0][0].toString() === expected?.toString(), (c) => `We expected query '${expected}', but we received query '${c[0][0]}' instead.`).else(`Received query does match '${expected}'`);
4
4
  expect.extend({ toBeQueriedWith });
5
- //#endregion
6
5
  export { toBeQueriedWith };
7
6
 
8
7
  //# sourceMappingURL=toBeQueriedWith.js.map
@@ -1,5 +1,4 @@
1
1
  import { Uri } from "../utils/Types.js";
2
- //#region src/matchers/toBeRoutedTo.d.ts
3
2
  export declare const weExpectedButReceivedInstead: ([r, e]: [any, any]) => string;
4
3
  export declare function toMatchAsString(this: jest.MatcherContext, received: unknown, expected: unknown): jest.CustomMatcherResult;
5
4
  export declare const toBeRoutedTo: (query: jest.Mock, expected: Uri) => jest.CustomMatcherResult;
@@ -10,5 +9,4 @@ declare global {
10
9
  }
11
10
  }
12
11
  }
13
- //#endregion
14
12
  //# sourceMappingURL=toBeRoutedTo.d.ts.map
@@ -1,14 +1,13 @@
1
+ import { checkDefined } from "./Check.js";
1
2
  import { asString } from "../utils/Utils.js";
2
3
  import { match } from "./Match.js";
3
- import { checkDefined } from "./Check.js";
4
- //#region src/matchers/toBeRoutedTo.ts
4
+ // src/matchers/toBeRoutedTo.ts
5
5
  const weExpectedButReceivedInstead = ([r, e]) => `We expected ${asString(e)}, but we received '${asString(r)}' instead.`;
6
6
  function toMatchAsString(received, expected) {
7
7
  return checkDefined(this, received, expected).not(([r, e]) => this.equals(asString(r), asString(e)), ([r, e]) => weExpectedButReceivedInstead([r, e])).else();
8
8
  }
9
9
  const toBeRoutedTo = (query, expected) => match(query?.mock?.calls).undefined((c) => c, "Uri is unknown.").not((c) => c.length === 1, "Method was not called.").not((c) => asString(c[0][0]) === asString(expected), (c) => `We expected uri '${asString(expected)}', but we received uri '${asString(c[0][0])}' instead.`).else(`Called uri does match '${asString(expected)}'`);
10
10
  expect.extend({ toBeRoutedTo });
11
- //#endregion
12
11
  export { toBeRoutedTo, toMatchAsString, weExpectedButReceivedInstead };
13
12
 
14
13
  //# sourceMappingURL=toBeRoutedTo.js.map
@@ -1,4 +1,3 @@
1
- //#region src/matchers/toBeValid.d.ts
2
1
  export declare const toBeValid: (v?: unknown) => jest.CustomMatcherResult;
3
2
  declare global {
4
3
  namespace jest {
@@ -7,5 +6,4 @@ declare global {
7
6
  }
8
7
  }
9
8
  }
10
- //#endregion
11
9
  //# sourceMappingURL=toBeValid.d.ts.map
@@ -1,9 +1,8 @@
1
1
  import { isA } from "../utils/Utils.js";
2
2
  import { match } from "./Match.js";
3
- //#region src/matchers/toBeValid.ts
3
+ // src/matchers/toBeValid.ts
4
4
  const 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`);
5
5
  expect.extend({ toBeValid });
6
- //#endregion
7
6
  export { toBeValid };
8
7
 
9
8
  //# sourceMappingURL=toBeValid.js.map
@@ -1,5 +1,4 @@
1
1
  import { Message } from "../utils/Types.js";
2
- //#region src/matchers/toFailMatcher.d.ts
3
2
  export declare const Fails: {
4
3
  Yes: string;
5
4
  No: (reason: string) => string;
@@ -18,5 +17,4 @@ declare global {
18
17
  }
19
18
  }
20
19
  }
21
- //#endregion
22
20
  //# sourceMappingURL=toFailMatcher.d.ts.map
@@ -1,6 +1,6 @@
1
- import { toMessage } from "../utils/Types.js";
2
1
  import { match } from "./Match.js";
3
- //#region src/matchers/toFailMatcher.ts
2
+ import { toMessage } from "../utils/Types.js";
3
+ // src/matchers/toFailMatcher.ts
4
4
  const Fails = {
5
5
  Yes: "Match fails, instead of passes.",
6
6
  No: (reason) => `Match doesn't fail, because '${reason}'`
@@ -15,7 +15,6 @@ expect.extend({
15
15
  toFailMatcher,
16
16
  toFailMatcherWith
17
17
  });
18
- //#endregion
19
18
  export { Fails, FailsWith, toFailMatcher, toFailMatcherWith };
20
19
 
21
20
  //# sourceMappingURL=toFailMatcher.js.map
@@ -1,4 +1,3 @@
1
- //#region src/matchers/toMatchArray.d.ts
2
1
  export declare function toMatchArray(this: jest.MatcherContext, received: any[], expected: any[]): jest.CustomMatcherResult;
3
2
  declare global {
4
3
  namespace jest {
@@ -7,5 +6,4 @@ declare global {
7
6
  }
8
7
  }
9
8
  }
10
- //#endregion
11
9
  //# sourceMappingURL=toMatchArray.d.ts.map
@@ -1,10 +1,9 @@
1
1
  import { checkDefined } from "./Check.js";
2
- //#region src/matchers/toMatchArray.ts
2
+ // src/matchers/toMatchArray.ts
3
3
  function toMatchArray(received, expected) {
4
4
  return checkDefined(this, received, expected).not(([r, e]) => r.length === e.length, ([r, e]) => `Received array has length ${r.length}, while expected array has length ${e.length}.`).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();
5
5
  }
6
6
  expect.extend({ toMatchArray });
7
- //#endregion
8
7
  export { toMatchArray };
9
8
 
10
9
  //# sourceMappingURL=toMatchArray.js.map
@@ -1,4 +1,3 @@
1
- //#region src/matchers/toMatchExactJson.d.ts
2
1
  export declare const MatchesExactJson: {
3
2
  SubjectUndefined: string;
4
3
  SubsetUndefined: string;
@@ -13,5 +12,4 @@ declare global {
13
12
  }
14
13
  }
15
14
  }
16
- //#endregion
17
15
  //# sourceMappingURL=toMatchExactJson.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { match } from "./Match.js";
2
2
  import { eq } from "../utils/Eq.js";
3
- //#region src/matchers/toMatchExactJson.ts
3
+ // src/matchers/toMatchExactJson.ts
4
4
  const MatchesExactJson = {
5
5
  SubjectUndefined: "Subject is undefined.",
6
6
  SubsetUndefined: "Object to match with is undefined.",
@@ -9,7 +9,6 @@ const MatchesExactJson = {
9
9
  };
10
10
  const toMatchExactJson = (value, json) => match(value).undefined((v) => v, MatchesExactJson.SubjectUndefined).undefined(() => json, MatchesExactJson.SubsetUndefined).not((v) => eq.exact(v, json), MatchesExactJson.DoesNotMatch).else(() => MatchesExactJson.Yes);
11
11
  expect.extend({ toMatchExactJson });
12
- //#endregion
13
12
  export { MatchesExactJson, toMatchExactJson };
14
13
 
15
14
  //# sourceMappingURL=toMatchExactJson.js.map
@@ -1,5 +1,4 @@
1
1
  import { Exception } from "../utils/Types.js";
2
- //#region src/matchers/toMatchException.d.ts
3
2
  export declare const toMatchException: (received: Exception, expected: unknown, reason?: string) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toMatchException.d.ts.map
@@ -1,9 +1,8 @@
1
- import { isDefined } from "../utils/Utils.js";
2
1
  import { match } from "./Match.js";
3
- //#region src/matchers/toMatchException.ts
2
+ import { isDefined } from "../utils/Utils.js";
3
+ // src/matchers/toMatchException.ts
4
4
  const toMatchException = (received, expected, reason) => match(expected).undefined((e) => e.id, "Expected value is not an exception.").not((e) => e.id === received.id, (e) => `Expected exception has id '${e.id}', while the received exception has id '${received.id}'.`).not(() => !isDefined(reason) || isDefined(reason) && isDefined(received.reason), () => `We expected to have reason '${reason}', but we received no reason.`).not(() => !isDefined(reason) || isDefined(reason) && received.reason === reason, () => `We expected to have reason '${reason}', but we received reason '${received.reason}'.`).else(`Expected exception matches received exception`);
5
5
  expect.extend({ toMatchException });
6
- //#endregion
7
6
  export { toMatchException };
8
7
 
9
8
  //# sourceMappingURL=toMatchException.js.map
@@ -1,4 +1,3 @@
1
- //#region src/matchers/toMatchJson.d.ts
2
1
  export declare const MatchesJson: {
3
2
  SubjectUndefined: string;
4
3
  SubsetUndefined: string;
@@ -13,5 +12,4 @@ declare global {
13
12
  }
14
13
  }
15
14
  }
16
- //#endregion
17
15
  //# sourceMappingURL=toMatchJson.d.ts.map
@@ -1,7 +1,7 @@
1
- import { asJson } from "../utils/Utils.js";
2
1
  import { match } from "./Match.js";
3
2
  import { eq } from "../utils/Eq.js";
4
- //#region src/matchers/toMatchJson.ts
3
+ import { asJson } from "../utils/Utils.js";
4
+ // src/matchers/toMatchJson.ts
5
5
  const MatchesJson = {
6
6
  SubjectUndefined: "Subject is undefined.",
7
7
  SubsetUndefined: "Subset to match with is undefined.",
@@ -10,7 +10,6 @@ const MatchesJson = {
10
10
  };
11
11
  const toMatchJson = (value, subset) => match(value).undefined((v) => v, MatchesJson.SubjectUndefined).undefined(() => subset, MatchesJson.SubsetUndefined).not((v) => eq.subset(asJson(v), asJson(subset)), MatchesJson.DoesNotMatch).else(() => MatchesJson.Yes);
12
12
  expect.extend({ toMatchJson });
13
- //#endregion
14
13
  export { MatchesJson, toMatchJson };
15
14
 
16
15
  //# sourceMappingURL=toMatchJson.js.map
@@ -1,5 +1,4 @@
1
1
  import { Uri } from "../utils/Types.js";
2
- //#region src/matchers/toMatchRoute.d.ts
3
2
  export declare const toMatchRoute: (uri?: Uri, route?: Uri | string) => jest.CustomMatcherResult;
4
3
  declare global {
5
4
  namespace jest {
@@ -8,5 +7,4 @@ declare global {
8
7
  }
9
8
  }
10
9
  }
11
- //#endregion
12
10
  //# sourceMappingURL=toMatchRoute.d.ts.map
@@ -1,9 +1,8 @@
1
- import { asString } from "../utils/Utils.js";
2
1
  import { match } from "./Match.js";
3
- //#region src/matchers/toMatchRoute.ts
2
+ import { asString } from "../utils/Utils.js";
3
+ // src/matchers/toMatchRoute.ts
4
4
  const toMatchRoute = (uri, route) => match(uri).undefined((u) => u, "Subject is undefined.").undefined(() => route, "Route to include is undefined.").not((u) => asString(u).includes(asString(route)), (u) => `Uri '${u}' does not include '${route}'.`).else((u) => `Uri '${u}' includes '${route}'`);
5
5
  expect.extend({ toMatchRoute });
6
- //#endregion
7
6
  export { toMatchRoute };
8
7
 
9
8
  //# sourceMappingURL=toMatchRoute.js.map
@@ -1,4 +1,3 @@
1
- //#region src/matchers/toMatchText.d.ts
2
1
  export declare const toMatchText: (value?: unknown, text?: unknown) => jest.CustomMatcherResult;
3
2
  declare global {
4
3
  namespace jest {
@@ -7,5 +6,4 @@ declare global {
7
6
  }
8
7
  }
9
8
  }
10
- //#endregion
11
9
  //# sourceMappingURL=toMatchText.d.ts.map
@@ -1,9 +1,8 @@
1
- import { asString } from "../utils/Utils.js";
2
1
  import { match } from "./Match.js";
3
- //#region src/matchers/toMatchText.ts
2
+ import { asString } from "../utils/Utils.js";
3
+ // src/matchers/toMatchText.ts
4
4
  const toMatchText = (value, text) => match(value).undefined((v) => v, "Subject is undefined.").undefined(() => text, "Text to match with is undefined.").not((v) => asString(v) === asString(text), (v) => `Text '${v}' does not match with text '${text}'.`).else((v) => `Text '${v}' matches`);
5
5
  expect.extend({ toMatchText });
6
- //#endregion
7
6
  export { toMatchText };
8
7
 
9
8
  //# sourceMappingURL=toMatchText.js.map
@@ -1,5 +1,4 @@
1
1
  import { Message } from "../utils/Types.js";
2
- //#region src/matchers/toPassMatcher.d.ts
3
2
  export declare const Passes: {
4
3
  Yes: string;
5
4
  No: (reason: string) => string;
@@ -18,5 +17,4 @@ declare global {
18
17
  }
19
18
  }
20
19
  }
21
- //#endregion
22
20
  //# sourceMappingURL=toPassMatcher.d.ts.map
@@ -1,6 +1,6 @@
1
- import { toMessage } from "../utils/Types.js";
2
1
  import { match } from "./Match.js";
3
- //#region src/matchers/toPassMatcher.ts
2
+ import { toMessage } from "../utils/Types.js";
3
+ // src/matchers/toPassMatcher.ts
4
4
  const Passes = {
5
5
  Yes: "Match passes, instead of fails.",
6
6
  No: (reason) => `Match doesn't pass, because '${reason}'`
@@ -15,7 +15,6 @@ expect.extend({
15
15
  toPassMatcher,
16
16
  toPassMatcherWith
17
17
  });
18
- //#endregion
19
18
  export { Passes, PassesWith, toPassMatcher, toPassMatcherWith };
20
19
 
21
20
  //# sourceMappingURL=toPassMatcher.js.map
@@ -1,6 +1,5 @@
1
1
  import { Uri } from "../utils/Types.js";
2
2
  import { AsymmetricMatcher } from "expect";
3
- //#region src/mock/Fits.d.ts
4
3
  export declare class ObjectContainingText extends AsymmetricMatcher<string> {
5
4
  asymmetricMatch(other: any): boolean;
6
5
  toString(): string;
@@ -23,5 +22,4 @@ export declare const fits: {
23
22
  json: (s: any) => any;
24
23
  items: (...items: any[]) => any;
25
24
  };
26
- //#endregion
27
25
  //# sourceMappingURL=Fits.d.ts.map
package/dist/mock/Fits.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { asJson, asString, toArray } from "../utils/Utils.js";
2
2
  import { eq } from "../utils/Eq.js";
3
3
  import { AsymmetricMatcher } from "expect";
4
- //#region src/mock/Fits.ts
4
+ // src/mock/Fits.ts
5
5
  var ObjectContainingText = class extends AsymmetricMatcher {
6
6
  asymmetricMatch(other) {
7
7
  return asString(other).includes(asString(this.sample));
@@ -29,14 +29,13 @@ var ObjectContainingJson = class extends AsymmetricMatcher {
29
29
  const fits = {
30
30
  any: () => expect.anything(),
31
31
  type: (type) => expect.any(type),
32
- with: (o) => expect.objectContaining(o),
32
+ with: (o) => Array.isArray(o) ? expect.arrayContaining(o) : expect.objectContaining(o),
33
33
  text: (s) => new ObjectContainingText(s),
34
34
  textExact: (s) => new ObjectContainingTextExact(s),
35
35
  uri: (u) => fits.textExact(u),
36
36
  json: (s) => new ObjectContainingJson(s),
37
37
  items: (...items) => expect.arrayContaining(toArray(...items))
38
38
  };
39
- //#endregion
40
39
  export { ObjectContainingJson, ObjectContainingText, ObjectContainingTextExact, fits };
41
40
 
42
41
  //# sourceMappingURL=Fits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Fits.js","names":[],"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":";;;;AAKA,IAAa,uBAAb,cAA0C,kBAA0B;CAClE,gBAAgB,OAAY;EAC1B,OAAO,SAAS,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,MAAM,CAAC;CACvD;CAEA,WAAW;EACT,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;CAC5C;AACF;AAEA,IAAa,4BAAb,cAA+C,kBAA0B;CACvE,gBAAgB,OAAY;EAC1B,OAAO,SAAS,KAAK,MAAM,SAAS,KAAK,MAAM;CACjD;CAEA,WAAW;EACT,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;CAC5C;AACF;AAEA,IAAa,uBAAb,cAA0C,kBAAuB;CAC/D,gBAAgB,OAAY;EAC1B,OAAO,GAAG,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK,MAAM,CAAC;CACrD;CAEA,WAAW;EACT,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;CAC5C;AACF;AAEA,MAAa,OAAO;CAClB,WAAgB,OAAO,SAAS;CAChC,OAAO,SAAwB,OAAO,IAAI,IAAI;CAC9C,OAAO,MAAoB,OAAO,iBAAiB,CAAC;CACpD,OAAO,MAAgB,IAAI,qBAAqB,CAAC;CACjD,YAAY,MAAgB,IAAI,0BAA0B,CAAC;CAC3D,MAAM,MAAgB,KAAK,UAAU,CAAC;CACtC,OAAO,MAAgB,IAAI,qBAAqB,CAAC;CACjD,QAAQ,GAAG,UAAsB,OAAO,gBAAgB,QAAQ,GAAG,KAAK,CAAC;AAC3E"}
1
+ {"version":3,"file":"Fits.js","names":[],"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 // Jest 30's objectContaining never matches arrays, so array samples check their items instead.\n with: (o: unknown): any => (Array.isArray(o) ? expect.arrayContaining(o) : 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":";;;;AAKA,IAAa,uBAAb,cAA0C,kBAA0B;CAClE,gBAAgB,OAAY;EAC1B,OAAO,SAAS,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,MAAM,CAAC;CACvD;CAEA,WAAW;EACT,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;CAC5C;AACF;AAEA,IAAa,4BAAb,cAA+C,kBAA0B;CACvE,gBAAgB,OAAY;EAC1B,OAAO,SAAS,KAAK,MAAM,SAAS,KAAK,MAAM;CACjD;CAEA,WAAW;EACT,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;CAC5C;AACF;AAEA,IAAa,uBAAb,cAA0C,kBAAuB;CAC/D,gBAAgB,OAAY;EAC1B,OAAO,GAAG,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK,MAAM,CAAC;CACrD;CAEA,WAAW;EACT,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;CAC5C;AACF;AAEA,MAAa,OAAO;CAClB,WAAgB,OAAO,SAAS;CAChC,OAAO,SAAwB,OAAO,IAAI,IAAI;CAE9C,OAAO,MAAqB,MAAM,QAAQ,CAAC,IAAI,OAAO,gBAAgB,CAAC,IAAI,OAAO,iBAAiB,CAAC;CACpG,OAAO,MAAgB,IAAI,qBAAqB,CAAC;CACjD,YAAY,MAAgB,IAAI,0BAA0B,CAAC;CAC3D,MAAM,MAAgB,KAAK,UAAU,CAAC;CACtC,OAAO,MAAgB,IAAI,qBAAqB,CAAC;CACjD,QAAQ,GAAG,UAAsB,OAAO,gBAAgB,QAAQ,GAAG,KAAK,CAAC;AAC3E"}
@@ -1,7 +1,6 @@
1
1
  import { Id, Json } from "../utils/Types.js";
2
- import { HttpStatus, Response } from "../utils/Response.js";
3
2
  import { Req } from "../utils/Req.js";
4
- //#region src/mock/Mocks.d.ts
3
+ import { HttpStatus, Response } from "../utils/Response.js";
5
4
  export declare class Mocks {
6
5
  req: {
7
6
  id: (id: Id) => Req;
@@ -38,5 +37,4 @@ export declare class Mocks {
38
37
  once: (...values: unknown[]) => jest.Mock;
39
38
  }
40
39
  export declare const mock: Mocks;
41
- //#endregion
42
40
  //# sourceMappingURL=Mocks.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { Req } from "../utils/Req.js";
2
- //#region src/mock/Mocks.ts
2
+ // src/mock/Mocks.ts
3
3
  var Mocks = class {
4
4
  req = {
5
5
  id: (id) => new Req({ id }),
@@ -62,7 +62,6 @@ function isJestMock(fn) {
62
62
  return typeof fn === "function" && "mock" in fn && Array.isArray(fn.mock?.calls);
63
63
  }
64
64
  const mock = new Mocks();
65
- //#endregion
66
65
  export { Mocks, mock };
67
66
 
68
67
  //# sourceMappingURL=Mocks.js.map
@@ -1,8 +1,6 @@
1
- //#region src/utils/Eq.d.ts
2
1
  export declare const eq: {
3
2
  exact: (a?: unknown, b?: unknown) => boolean;
4
3
  subset: (a?: unknown, b?: unknown) => boolean;
5
4
  string: (a?: unknown, b?: unknown) => boolean;
6
5
  };
7
- //#endregion
8
6
  //# sourceMappingURL=Eq.d.ts.map
package/dist/utils/Eq.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import { asString } from "./Utils.js";
2
2
  import { equals, iterableEquality, subsetEquality } from "@jest/expect-utils";
3
- //#region src/utils/Eq.ts
3
+ // src/utils/Eq.ts
4
4
  const eq = {
5
5
  exact: (a, b) => equals(a, b, []),
6
6
  subset: (a, b) => equals(a, b, [iterableEquality, subsetEquality]),
7
7
  string: (a, b) => asString(a) === asString(b)
8
8
  };
9
- //#endregion
10
9
  export { eq };
11
10
 
12
11
  //# sourceMappingURL=Eq.js.map
@@ -1,5 +1,4 @@
1
1
  import { Id, Json, JsonValue, OneOrMore, Text } from "./Types.js";
2
- //#region src/utils/Req.d.ts
3
2
  export declare class Req<B = unknown> {
4
3
  readonly state: any;
5
4
  readonly skip: number | undefined;
@@ -13,5 +12,4 @@ export declare class Req<B = unknown> {
13
12
  get headers(): Record<string, OneOrMore<string>>;
14
13
  get: (key: Text) => any;
15
14
  }
16
- //#endregion
17
15
  //# sourceMappingURL=Req.d.ts.map
package/dist/utils/Req.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { asNumber, isDefined } from "./Utils.js";
2
- //#region src/utils/Req.ts
2
+ // src/utils/Req.ts
3
3
  var Req = class {
4
4
  state;
5
5
  skip;
@@ -29,7 +29,6 @@ var Req = class {
29
29
  }
30
30
  get = (key) => this?.state[key.toString()] ?? this.path[key.toString()] ?? this.query[key.toString()];
31
31
  };
32
- //#endregion
33
32
  export { Req };
34
33
 
35
34
  //# sourceMappingURL=Req.js.map
@@ -1,5 +1,4 @@
1
1
  import { Id } from "./Types.js";
2
- //#region src/utils/Response.d.ts
3
2
  export type HttpStatus = {
4
3
  name: string;
5
4
  id: Id;
@@ -24,5 +23,4 @@ export type Response = {
24
23
  };
25
24
  body?: RestResult;
26
25
  };
27
- //#endregion
28
26
  //# sourceMappingURL=Response.d.ts.map
@@ -1,4 +1,3 @@
1
- //#region src/utils/Types.d.ts
2
1
  export type OneOrMore<T> = T | Array<T>;
3
2
  export type ArrayLike<T> = OneOrMore<T>[];
4
3
  export type Constructor<T> = {
@@ -41,5 +40,4 @@ export type Tester = {
41
40
  url: string;
42
41
  };
43
42
  export type CreateMutable<T> = { -readonly [P in keyof T]: T[P]; };
44
- //#endregion
45
43
  //# sourceMappingURL=Types.d.ts.map
@@ -1,7 +1,6 @@
1
1
  import { asString, isFunction } from "./Utils.js";
2
- //#region src/utils/Types.ts
2
+ // src/utils/Types.ts
3
3
  const toMessage = (g, ...params) => asString(isFunction(g) ? g(...params) : g);
4
- //#endregion
5
4
  export { toMessage };
6
5
 
7
6
  //# sourceMappingURL=Types.js.map
@@ -1,5 +1,4 @@
1
1
  import { ArrayLike } from "./Types.js";
2
- //#region src/utils/Utils.d.ts
3
2
  export declare const isDefined: <T = unknown>(o?: T) => boolean;
4
3
  export declare const isNumber: (o?: unknown) => o is number;
5
4
  export declare const isFunction: (o?: unknown) => o is (...params: unknown[]) => unknown;
@@ -11,5 +10,4 @@ export declare const asJson: (a?: unknown) => any;
11
10
  export declare const asString: (a?: unknown) => string;
12
11
  export declare const asNumber: (num: unknown, alt?: number | (() => number)) => number;
13
12
  export declare const toArray: <T>(...items: ArrayLike<T>) => T[];
14
- //#endregion
15
13
  //# sourceMappingURL=Utils.d.ts.map
@@ -1,4 +1,4 @@
1
- //#region src/utils/Utils.ts
1
+ // src/utils/Utils.ts
2
2
  const isDefined = (o) => o !== void 0 && o !== null;
3
3
  const isNumber = (o) => isDefined(o) && typeof o === "number" && !Number.isNaN(o);
4
4
  const isFunction = (o) => isDefined(o) && typeof o === "function";
@@ -13,7 +13,6 @@ const asNumber = (num, alt) => {
13
13
  return isNumber(n) ? n : isFunction(alt) ? alt() : isNumber(alt) ? alt : NaN;
14
14
  };
15
15
  const toArray = (...items) => items.length > 1 ? items : isArray(items[0]) ? items[0] : isDefined(items[0]) ? [items[0]] : [];
16
- //#endregion
17
16
  export { asJson, asNumber, asString, isA, isAn, isArray, isDefined, isFunction, isNumber, isObject, toArray };
18
17
 
19
18
  //# sourceMappingURL=Utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-test",
3
- "version": "21.2.0",
3
+ "version": "21.2.1",
4
4
  "description": "Straightforward library for testing microservices built with @thisisagile/easy",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
@@ -44,18 +44,18 @@
44
44
  "node": ">=20.19.0"
45
45
  },
46
46
  "devDependencies": {
47
- "typescript": "^5.7.3",
47
+ "typescript": "~6.0.3",
48
48
  "weak-napi": "^2.0.2"
49
49
  },
50
50
  "dependencies": {
51
- "@jest/expect-utils": "^30.4.1",
51
+ "@jest/expect-utils": "^30.5.2",
52
52
  "@types/jest": "^30.0.0",
53
- "@types/node": "^20.19.0",
54
- "expect": "^30.4.1",
55
- "jest": "^30.4.2",
53
+ "@types/node": "^26.6.6",
54
+ "expect": "^30.5.2",
55
+ "jest": "^30.5.2",
56
56
  "jest-junit": "^17.0.0",
57
57
  "jest-sonar-reporter": "^2.0.0",
58
- "ts-jest": "^29.4.11"
58
+ "ts-jest": "^29.4.15"
59
59
  },
60
60
  "exports": {
61
61
  ".": {
@@ -2,7 +2,11 @@ import { isDefined } from '../utils/Utils';
2
2
  import { Message, toMessage } from '../utils/Types';
3
3
 
4
4
  export class Match<S> {
5
- constructor(private readonly subject: S, private readonly failed = false, private readonly message: Message<S> = '') {}
5
+ constructor(
6
+ private readonly subject: S,
7
+ private readonly failed = false,
8
+ private readonly message: Message<S> = ''
9
+ ) {}
6
10
 
7
11
  not(p: (s: S) => boolean, message: Message<S>): Match<S> {
8
12
  if (this.failed) {
@@ -11,7 +15,6 @@ export class Match<S> {
11
15
  try {
12
16
  return new Match<S>(this.subject, !p(this.subject), toMessage(message, this.subject));
13
17
  } catch (e: any) {
14
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
15
18
  return new Match<S>(this.subject, true, e.message);
16
19
  }
17
20
  }
package/src/mock/Fits.ts CHANGED
@@ -36,7 +36,8 @@ export class ObjectContainingJson extends AsymmetricMatcher<any> {
36
36
  export const fits = {
37
37
  any: (): any => expect.anything(),
38
38
  type: (type?: unknown): any => expect.any(type),
39
- with: (o: unknown): any => expect.objectContaining(o),
39
+ // Jest 30's objectContaining never matches arrays, so array samples check their items instead.
40
+ with: (o: unknown): any => (Array.isArray(o) ? expect.arrayContaining(o) : expect.objectContaining(o)),
40
41
  text: (s: any): any => new ObjectContainingText(s),
41
42
  textExact: (s: any): any => new ObjectContainingTextExact(s),
42
43
  uri: (u: Uri): any => fits.textExact(u),