@thisisagile/easy-test 15.8.6 → 15.8.7

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 (147) hide show
  1. package/dist/index.d.ts +2 -379
  2. package/dist/index.js +25 -3
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +3 -3
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/matchers/Check.d.ts +17 -0
  7. package/dist/matchers/Check.js +64 -0
  8. package/dist/matchers/Check.js.map +1 -0
  9. package/dist/matchers/Check.mjs +39 -0
  10. package/dist/matchers/Check.mjs.map +1 -0
  11. package/dist/matchers/HttpMatchers.d.ts +31 -0
  12. package/dist/matchers/HttpMatchers.js +89 -0
  13. package/dist/matchers/HttpMatchers.js.map +1 -0
  14. package/dist/matchers/HttpMatchers.mjs +54 -0
  15. package/dist/matchers/HttpMatchers.mjs.map +1 -0
  16. package/dist/matchers/Match.d.ts +12 -0
  17. package/dist/matchers/Match.js +59 -0
  18. package/dist/matchers/Match.js.map +1 -0
  19. package/dist/matchers/Match.mjs +34 -0
  20. package/dist/matchers/Match.mjs.map +1 -0
  21. package/dist/matchers/ResultMatchers.d.ts +13 -0
  22. package/dist/matchers/ResultMatchers.js +51 -0
  23. package/dist/matchers/ResultMatchers.js.map +1 -0
  24. package/dist/matchers/ResultMatchers.mjs +25 -0
  25. package/dist/matchers/ResultMatchers.mjs.map +1 -0
  26. package/dist/matchers/index.d.ts +19 -0
  27. package/dist/matchers/index.js +59 -0
  28. package/dist/matchers/index.js.map +1 -0
  29. package/dist/matchers/index.mjs +20 -0
  30. package/dist/matchers/index.mjs.map +1 -0
  31. package/dist/matchers/toBeArrayOf.d.ts +9 -0
  32. package/dist/matchers/toBeArrayOf.js +33 -0
  33. package/dist/matchers/toBeArrayOf.js.map +1 -0
  34. package/dist/matchers/toBeArrayOf.mjs +9 -0
  35. package/dist/matchers/toBeArrayOf.mjs.map +1 -0
  36. package/dist/matchers/toBeArrayOfWithLength.d.ts +9 -0
  37. package/dist/matchers/toBeArrayOfWithLength.js +36 -0
  38. package/dist/matchers/toBeArrayOfWithLength.js.map +1 -0
  39. package/dist/matchers/toBeArrayOfWithLength.mjs +12 -0
  40. package/dist/matchers/toBeArrayOfWithLength.mjs.map +1 -0
  41. package/dist/matchers/toBeAt.d.ts +9 -0
  42. package/dist/matchers/toBeAt.js +44 -0
  43. package/dist/matchers/toBeAt.js.map +1 -0
  44. package/dist/matchers/toBeAt.mjs +20 -0
  45. package/dist/matchers/toBeAt.mjs.map +1 -0
  46. package/dist/matchers/toBeExactlyAt.d.ts +9 -0
  47. package/dist/matchers/toBeExactlyAt.js +43 -0
  48. package/dist/matchers/toBeExactlyAt.js.map +1 -0
  49. package/dist/matchers/toBeExactlyAt.mjs +19 -0
  50. package/dist/matchers/toBeExactlyAt.mjs.map +1 -0
  51. package/dist/matchers/toBeQueriedWith.d.ts +9 -0
  52. package/dist/matchers/toBeQueriedWith.js +36 -0
  53. package/dist/matchers/toBeQueriedWith.js.map +1 -0
  54. package/dist/matchers/toBeQueriedWith.mjs +12 -0
  55. package/dist/matchers/toBeQueriedWith.mjs.map +1 -0
  56. package/dist/matchers/toBeRoutedTo.d.ts +9 -0
  57. package/dist/matchers/toBeRoutedTo.js +37 -0
  58. package/dist/matchers/toBeRoutedTo.js.map +1 -0
  59. package/dist/matchers/toBeRoutedTo.mjs +13 -0
  60. package/dist/matchers/toBeRoutedTo.mjs.map +1 -0
  61. package/dist/matchers/toBeValid.d.ts +8 -0
  62. package/dist/matchers/toBeValid.js +34 -0
  63. package/dist/matchers/toBeValid.js.map +1 -0
  64. package/dist/matchers/toBeValid.mjs +10 -0
  65. package/dist/matchers/toBeValid.mjs.map +1 -0
  66. package/dist/matchers/toFailMatcher.d.ts +19 -0
  67. package/dist/matchers/toFailMatcher.js +59 -0
  68. package/dist/matchers/toFailMatcher.js.map +1 -0
  69. package/dist/matchers/toFailMatcher.mjs +32 -0
  70. package/dist/matchers/toFailMatcher.mjs.map +1 -0
  71. package/dist/matchers/toMatchArray.d.ts +9 -0
  72. package/dist/matchers/toMatchArray.js +35 -0
  73. package/dist/matchers/toMatchArray.js.map +1 -0
  74. package/dist/matchers/toMatchArray.mjs +11 -0
  75. package/dist/matchers/toMatchArray.mjs.map +1 -0
  76. package/dist/matchers/toMatchExactJson.d.ts +14 -0
  77. package/dist/matchers/toMatchExactJson.js +42 -0
  78. package/dist/matchers/toMatchExactJson.js.map +1 -0
  79. package/dist/matchers/toMatchExactJson.mjs +17 -0
  80. package/dist/matchers/toMatchExactJson.mjs.map +1 -0
  81. package/dist/matchers/toMatchException.d.ts +9 -0
  82. package/dist/matchers/toMatchException.js +43 -0
  83. package/dist/matchers/toMatchException.js.map +1 -0
  84. package/dist/matchers/toMatchException.mjs +19 -0
  85. package/dist/matchers/toMatchException.mjs.map +1 -0
  86. package/dist/matchers/toMatchJson.d.ts +14 -0
  87. package/dist/matchers/toMatchJson.js +43 -0
  88. package/dist/matchers/toMatchJson.js.map +1 -0
  89. package/dist/matchers/toMatchJson.mjs +18 -0
  90. package/dist/matchers/toMatchJson.mjs.map +1 -0
  91. package/dist/matchers/toMatchRoute.d.ts +9 -0
  92. package/dist/matchers/toMatchRoute.js +37 -0
  93. package/dist/matchers/toMatchRoute.js.map +1 -0
  94. package/dist/matchers/toMatchRoute.mjs +13 -0
  95. package/dist/matchers/toMatchRoute.mjs.map +1 -0
  96. package/dist/matchers/toMatchText.d.ts +8 -0
  97. package/dist/matchers/toMatchText.js +37 -0
  98. package/dist/matchers/toMatchText.js.map +1 -0
  99. package/dist/matchers/toMatchText.mjs +13 -0
  100. package/dist/matchers/toMatchText.mjs.map +1 -0
  101. package/dist/matchers/toPassMatcher.d.ts +19 -0
  102. package/dist/matchers/toPassMatcher.js +59 -0
  103. package/dist/matchers/toPassMatcher.js.map +1 -0
  104. package/dist/matchers/toPassMatcher.mjs +32 -0
  105. package/dist/matchers/toPassMatcher.mjs.map +1 -0
  106. package/dist/mock/Fits.d.ts +24 -0
  107. package/dist/mock/Fits.js +71 -0
  108. package/dist/mock/Fits.js.map +1 -0
  109. package/dist/mock/Fits.mjs +44 -0
  110. package/dist/mock/Fits.mjs.map +1 -0
  111. package/dist/mock/Mocks.d.ts +39 -0
  112. package/dist/mock/Mocks.js +98 -0
  113. package/dist/mock/Mocks.js.map +1 -0
  114. package/dist/mock/Mocks.mjs +73 -0
  115. package/dist/mock/Mocks.mjs.map +1 -0
  116. package/dist/mock/index.d.ts +2 -0
  117. package/dist/mock/index.js +25 -0
  118. package/dist/mock/index.js.map +1 -0
  119. package/dist/mock/index.mjs +3 -0
  120. package/dist/mock/index.mjs.map +1 -0
  121. package/dist/utils/Eq.d.ts +5 -0
  122. package/dist/utils/Eq.js +35 -0
  123. package/dist/utils/Eq.js.map +1 -0
  124. package/dist/utils/Eq.mjs +11 -0
  125. package/dist/utils/Eq.mjs.map +1 -0
  126. package/dist/utils/Req.d.ts +14 -0
  127. package/dist/utils/Req.js +59 -0
  128. package/dist/utils/Req.js.map +1 -0
  129. package/dist/utils/Req.mjs +35 -0
  130. package/dist/utils/Req.mjs.map +1 -0
  131. package/dist/utils/Response.d.ts +25 -0
  132. package/dist/utils/Response.js +17 -0
  133. package/dist/utils/Response.js.map +1 -0
  134. package/dist/utils/Response.mjs +1 -0
  135. package/dist/utils/Response.mjs.map +1 -0
  136. package/dist/utils/Types.d.ts +44 -0
  137. package/dist/utils/Types.js +30 -0
  138. package/dist/utils/Types.js.map +1 -0
  139. package/dist/utils/Types.mjs +6 -0
  140. package/dist/utils/Types.mjs.map +1 -0
  141. package/dist/utils/Utils.d.ts +12 -0
  142. package/dist/utils/Utils.js +62 -0
  143. package/dist/utils/Utils.js.map +1 -0
  144. package/dist/utils/Utils.mjs +28 -0
  145. package/dist/utils/Utils.mjs.map +1 -0
  146. package/package.json +2 -2
  147. package/dist/index.d.mts +0 -379
package/dist/index.d.ts CHANGED
@@ -1,379 +1,2 @@
1
- import { AsymmetricMatcher } from 'expect';
2
-
3
- type OneOrMore<T> = T | Array<T>;
4
- type Constructor<T> = {
5
- new (...args: any[]): T;
6
- };
7
- type Message<P> = Text | ((...params: P[]) => Text);
8
- type Validatable = {
9
- isValid: boolean;
10
- };
11
- type Result = {
12
- domain?: string;
13
- location?: string;
14
- message: string;
15
- };
16
- type Results = Validatable & {
17
- results: Result[];
18
- };
19
- type Uri = Text;
20
- type Id = string | number;
21
- type JsonValue = string | number | boolean | null | Json | JsonValue[];
22
- type Json = {
23
- [key: string]: JsonValue;
24
- };
25
- type Exception = {
26
- id: Id;
27
- reason?: string;
28
- };
29
- type Text = {
30
- toString: () => string;
31
- };
32
- type Query = Text;
33
- type UseCase = {
34
- app: {
35
- id: Text;
36
- };
37
- id: Text;
38
- };
39
- type Tester = {
40
- url: string;
41
- };
42
-
43
- type HttpStatus = {
44
- name: string;
45
- id: Id;
46
- };
47
- type RestResult = {
48
- data?: {
49
- code: number;
50
- items: unknown[];
51
- itemCount: number;
52
- };
53
- error?: {
54
- code: number;
55
- message: string;
56
- errorCount: number;
57
- errors: unknown[];
58
- };
59
- };
60
- type Response = {
61
- status: HttpStatus;
62
- headers?: {
63
- [key: string]: any;
64
- };
65
- body?: RestResult;
66
- };
67
-
68
- declare const toHaveStatus: (res: Response, code: number) => jest.CustomMatcherResult;
69
- declare const toBeOk: (res: Response) => jest.CustomMatcherResult;
70
- declare const toBeCreated: (res: Response) => jest.CustomMatcherResult;
71
- declare const toHaveNoContent: (res: Response) => jest.CustomMatcherResult;
72
- declare const toBeBadRequest: (res: Response) => jest.CustomMatcherResult;
73
- declare const toBeUnauthorized: (res: Response) => jest.CustomMatcherResult;
74
- declare const toBeForbidden: (res: Response) => jest.CustomMatcherResult;
75
- declare const toBeNotFound: (res: Response) => jest.CustomMatcherResult;
76
- declare const toBeConflict: (res: Response) => jest.CustomMatcherResult;
77
- declare const toBeInternalServerError: (res: Response) => jest.CustomMatcherResult;
78
- declare const toBeBadGateway: (res: Response) => jest.CustomMatcherResult;
79
- declare const toBeOkWithItems: (res: Response, length: number) => jest.CustomMatcherResult;
80
- declare global {
81
- namespace jest {
82
- interface Matchers<R, T> {
83
- toBeOk(): R;
84
- toBeOkWithItems(length: number): R;
85
- toBeCreated(): R;
86
- toHaveNoContent(): R;
87
- toBeNotFound(): R;
88
- toBeUnauthorized(): R;
89
- toBeForbidden(): R;
90
- toBeBadRequest(): R;
91
- toBeConflict(): R;
92
- toBeInternalServerError(): R;
93
- toBeBadGateway(): R;
94
- toHaveStatus(code: number): R;
95
- }
96
- }
97
- }
98
-
99
- declare class Match<S> {
100
- private readonly subject;
101
- private readonly failed;
102
- private readonly message;
103
- constructor(subject: S, failed?: boolean, message?: Message<S>);
104
- not(p: (s: S) => boolean, message: Message<S>): Match<S>;
105
- undefined(p: (s: S) => any, message: Message<S>): Match<S>;
106
- else(message: Message<S>): jest.CustomMatcherResult;
107
- }
108
- declare const match: <S>(subject: S) => Match<S>;
109
-
110
- type ToMessage<S> = string | ((s: S[]) => string);
111
- declare class Check<S> {
112
- private ctx;
113
- private readonly received;
114
- private readonly expected;
115
- private readonly failed;
116
- private readonly message;
117
- constructor(ctx: jest.MatcherContext, received: S, expected: S, failed?: boolean, message?: string);
118
- print(message: ToMessage<S>): string;
119
- not(p: (s: S[]) => boolean, message: ToMessage<S>): Check<S>;
120
- undefined(p: (s: S[]) => any, message: ToMessage<S>): Check<S>;
121
- else(message?: ToMessage<S>): jest.CustomMatcherResult;
122
- }
123
- declare const check: <S>(ctx: jest.MatcherContext, received: S, expected?: S | undefined) => Check<S>;
124
- declare const checkDefined: <S>(ctx: jest.MatcherContext, received: S, expected?: S | undefined) => Check<S>;
125
-
126
- declare const toResultWith: (results: Results, message: string) => jest.CustomMatcherResult;
127
- declare const toFail: (results: Results) => jest.CustomMatcherResult;
128
- declare const toFailWith: (results: Results, message: string) => jest.CustomMatcherResult;
129
- declare global {
130
- namespace jest {
131
- interface Matchers<R, T> {
132
- toResultWith(message: string): R;
133
- toFail(): R;
134
- toFailWith(message: string): R;
135
- }
136
- }
137
- }
138
-
139
- declare const toBeArrayOf: <T>(items: unknown, ctor: Constructor<T>) => jest.CustomMatcherResult;
140
- declare global {
141
- namespace jest {
142
- interface Matchers<R, T> {
143
- toBeArrayOf<Z>(ctor: Constructor<Z>): R;
144
- }
145
- }
146
- }
147
-
148
- declare const toBeArrayOfWithLength: <T>(items: unknown, ctor: Constructor<T>, length: number) => jest.CustomMatcherResult;
149
- declare global {
150
- namespace jest {
151
- interface Matchers<R, T> {
152
- toBeArrayOfWithLength<Z>(ctor: Constructor<Z>, length: number): R;
153
- }
154
- }
155
- }
156
-
157
- declare const toBeAt: (tester?: Tester, uc?: UseCase, id?: Id) => jest.CustomMatcherResult;
158
- declare global {
159
- namespace jest {
160
- interface Matchers<R, T> {
161
- toBeAt(uc?: UseCase, id?: Id): R;
162
- }
163
- }
164
- }
165
-
166
- declare const toBeExactlyAt: (tester?: Tester, uc?: UseCase, id?: Id) => jest.CustomMatcherResult;
167
- declare global {
168
- namespace jest {
169
- interface Matchers<R, T> {
170
- toBeExactlyAt(uc?: UseCase, id?: Id): R;
171
- }
172
- }
173
- }
174
-
175
- declare const Fails: {
176
- Yes: string;
177
- No: (reason: string) => string;
178
- };
179
- declare const FailsWith: {
180
- Yes: string;
181
- No: (message: string, instead: string) => string;
182
- };
183
- declare const toFailMatcher: (result: jest.CustomMatcherResult) => jest.CustomMatcherResult;
184
- declare const toFailMatcherWith: (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>) => jest.CustomMatcherResult;
185
- declare global {
186
- namespace jest {
187
- interface Matchers<R, T> {
188
- toFailMatcher(): R;
189
- toFailMatcherWith(message: string): R;
190
- }
191
- }
192
- }
193
-
194
- declare const toBeValid: (v?: unknown) => jest.CustomMatcherResult;
195
- declare global {
196
- namespace jest {
197
- interface Matchers<R, T> {
198
- toBeValid(): R;
199
- }
200
- }
201
- }
202
-
203
- declare function toMatchArray(this: jest.MatcherContext, received: any[], expected: any[]): jest.CustomMatcherResult;
204
- declare global {
205
- namespace jest {
206
- interface Matchers<R, T> {
207
- toMatchArray(expected: any[]): R;
208
- }
209
- }
210
- }
211
-
212
- declare const MatchesExactJson: {
213
- SubjectUndefined: string;
214
- SubsetUndefined: string;
215
- DoesNotMatch: string;
216
- Yes: string;
217
- };
218
- declare const toMatchExactJson: (value?: unknown, json?: unknown) => jest.CustomMatcherResult;
219
- declare global {
220
- namespace jest {
221
- interface Matchers<R, T> {
222
- toMatchExactJson(json?: unknown): R;
223
- }
224
- }
225
- }
226
-
227
- declare const toMatchException: (received: Exception, expected: unknown, reason?: string) => jest.CustomMatcherResult;
228
- declare global {
229
- namespace jest {
230
- interface Matchers<R, T> {
231
- toMatchException(exception: unknown, reason?: string): R;
232
- }
233
- }
234
- }
235
-
236
- declare const MatchesJson: {
237
- SubjectUndefined: string;
238
- SubsetUndefined: string;
239
- DoesNotMatch: string;
240
- Yes: string;
241
- };
242
- declare const toMatchJson: (value?: unknown, subset?: unknown) => jest.CustomMatcherResult;
243
- declare global {
244
- namespace jest {
245
- interface Matchers<R, T> {
246
- toMatchJson(subset?: unknown): R;
247
- }
248
- }
249
- }
250
-
251
- declare const toMatchRoute: (uri?: Uri, route?: Uri | string) => jest.CustomMatcherResult;
252
- declare global {
253
- namespace jest {
254
- interface Matchers<R, T> {
255
- toMatchRoute(route?: Uri | string): R;
256
- }
257
- }
258
- }
259
-
260
- declare const toMatchText: (value?: unknown, text?: unknown) => jest.CustomMatcherResult;
261
- declare global {
262
- namespace jest {
263
- interface Matchers<R, T> {
264
- toMatchText(text?: unknown): R;
265
- }
266
- }
267
- }
268
-
269
- declare const Passes: {
270
- Yes: string;
271
- No: (reason: string) => string;
272
- };
273
- declare const PassesWith: {
274
- Yes: string;
275
- No: (message: string, instead: string) => string;
276
- };
277
- declare const toPassMatcher: (result: jest.CustomMatcherResult) => jest.CustomMatcherResult;
278
- declare const toPassMatcherWith: (result: jest.CustomMatcherResult, message: Message<jest.CustomMatcherResult>) => jest.CustomMatcherResult;
279
- declare global {
280
- namespace jest {
281
- interface Matchers<R, T> {
282
- toPassMatcher(): R;
283
- toPassMatcherWith(message: string): R;
284
- }
285
- }
286
- }
287
-
288
- declare const toBeQueriedWith: (query: jest.Mock, expected: Query) => jest.CustomMatcherResult;
289
- declare global {
290
- namespace jest {
291
- interface Matchers<R, T> {
292
- toBeQueriedWith(expected: Query): R;
293
- }
294
- }
295
- }
296
-
297
- declare const toBeRoutedTo: (query: jest.Mock, expected: Uri) => jest.CustomMatcherResult;
298
- declare global {
299
- namespace jest {
300
- interface Matchers<R, T> {
301
- toBeRoutedTo(uri: Uri): R;
302
- }
303
- }
304
- }
305
-
306
- declare class ObjectContainingText extends AsymmetricMatcher<string> {
307
- asymmetricMatch(other: any): boolean;
308
- toString(): string;
309
- }
310
- declare class ObjectContainingTextExact extends AsymmetricMatcher<string> {
311
- asymmetricMatch(other: any): boolean;
312
- toString(): string;
313
- }
314
- declare class ObjectContainingJson extends AsymmetricMatcher<any> {
315
- asymmetricMatch(other: any): boolean;
316
- toString(): string;
317
- }
318
- declare const fits: {
319
- any: () => any;
320
- type: (type?: unknown) => any;
321
- with: (o: unknown) => any;
322
- text: (s: any) => any;
323
- textExact: (s: any) => any;
324
- uri: (u: Uri) => any;
325
- json: (s: any) => any;
326
- items: (...items: any[]) => any;
327
- };
328
-
329
- declare class Req {
330
- readonly state: any;
331
- constructor(state?: any);
332
- get id(): Id;
333
- get q(): JsonValue;
334
- get path(): Json;
335
- get query(): Json;
336
- get skip(): number | undefined;
337
- get take(): number | undefined;
338
- get body(): unknown;
339
- get headers(): Record<string, OneOrMore<string>>;
340
- get: (key: Text) => any;
341
- }
342
-
343
- declare class Mocks {
344
- clear: () => typeof jest;
345
- impl: (f?: ((...args: any[]) => any) | undefined) => jest.Mock;
346
- property: <T extends object, P extends keyof { [K in keyof Required<T> as Required<T>[K] extends jest.Func ? never : K]: Required<T>[K]; }>(object: T, getter: P, value: T[P]) => jest.SpyInstance;
347
- reject: (value?: unknown) => jest.Mock;
348
- rejectWith: <T = any>(props?: Partial<T>) => jest.Mock;
349
- req: {
350
- id: (id: Id) => Req;
351
- q: (q: unknown) => Req;
352
- with: (a: Json) => Req;
353
- body: (body: unknown) => Req;
354
- path: (path: Json) => Req;
355
- query: (query: Json) => Req;
356
- };
357
- resp: {
358
- items: (status: HttpStatus, items?: unknown[]) => Response;
359
- errors: (status: HttpStatus, message: string, errors?: unknown[]) => Response;
360
- };
361
- resolve: (value?: unknown) => jest.Mock;
362
- resolveWith: <T = any>(props?: Partial<T>) => jest.Mock;
363
- return: (value?: unknown) => jest.Mock;
364
- returnWith: <T = any>(props?: Partial<T>) => jest.Mock;
365
- this: () => jest.Mock;
366
- provider: {
367
- data: (...items: any[]) => {
368
- execute: jest.Mock;
369
- };
370
- };
371
- empty: <T = any>(props?: Partial<T>) => T;
372
- a: <T = any>(props?: Partial<T>) => T;
373
- an: <T = any>(props?: Partial<T>) => T;
374
- date: (epoch?: number) => Date;
375
- once: (...values: unknown[]) => jest.Mock;
376
- }
377
- declare const mock: Mocks;
378
-
379
- export { Fails, FailsWith, Match, MatchesExactJson, MatchesJson, Mocks, ObjectContainingJson, ObjectContainingText, ObjectContainingTextExact, Passes, PassesWith, check, checkDefined, fits, match, mock, toBeArrayOf, toBeArrayOfWithLength, toBeAt, toBeBadGateway, toBeBadRequest, toBeConflict, toBeCreated, toBeExactlyAt, toBeForbidden, toBeInternalServerError, toBeNotFound, toBeOk, toBeOkWithItems, toBeQueriedWith, toBeRoutedTo, toBeUnauthorized, toBeValid, toFail, toFailMatcher, toFailMatcherWith, toFailWith, toHaveNoContent, toHaveStatus, toMatchArray, toMatchExactJson, toMatchException, toMatchJson, toMatchRoute, toMatchText, toPassMatcher, toPassMatcherWith, toResultWith };
1
+ export * from './matchers';
2
+ export * from './mock';
package/dist/index.js CHANGED
@@ -1,3 +1,25 @@
1
- "use strict";var C=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var Se=(t,e)=>{for(var s in e)C(t,s,{get:e[s],enumerable:!0})},we=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of be(e))!je.call(t,c)&&c!==s&&C(t,c,{get:()=>e[c],enumerable:!(n=Me(e,c))||n.enumerable});return t};var ke=t=>we(C({},"__esModule",{value:!0}),t);var $e={};Se($e,{Fails:()=>M,FailsWith:()=>N,Match:()=>R,MatchesExactJson:()=>x,MatchesJson:()=>y,Mocks:()=>T,ObjectContainingJson:()=>w,ObjectContainingText:()=>j,ObjectContainingTextExact:()=>S,Passes:()=>b,PassesWith:()=>q,check:()=>Ce,checkDefined:()=>B,fits:()=>ge,match:()=>o,mock:()=>l,toBeArrayOf:()=>te,toBeArrayOfWithLength:()=>se,toBeAt:()=>ne,toBeBadGateway:()=>H,toBeBadRequest:()=>I,toBeConflict:()=>Q,toBeCreated:()=>P,toBeExactlyAt:()=>re,toBeForbidden:()=>D,toBeInternalServerError:()=>L,toBeNotFound:()=>Y,toBeOk:()=>V,toBeOkWithItems:()=>Z,toBeQueriedWith:()=>ye,toBeRoutedTo:()=>Re,toBeUnauthorized:()=>O,toBeValid:()=>ce,toFail:()=>_,toFailMatcher:()=>ae,toFailMatcherWith:()=>ie,toFailWith:()=>ee,toHaveNoContent:()=>F,toHaveStatus:()=>i,toMatchArray:()=>ue,toMatchExactJson:()=>de,toMatchException:()=>pe,toMatchJson:()=>le,toMatchRoute:()=>me,toMatchText:()=>he,toPassMatcher:()=>fe,toPassMatcherWith:()=>xe,toResultWith:()=>X});module.exports=ke($e);var a=t=>t!=null,f=t=>a(t)&&typeof t=="number"&&!Number.isNaN(t),$=t=>a(t)&&typeof t=="function",A=(t,...e)=>a(t)&&e.every(s=>a(t[s]));var J=t=>a(t)&&t instanceof Array,Te=t=>t!=null&&(typeof t=="object"||typeof t=="function")&&!J(t),m=t=>t?.toJSON?t.toJSON():Te(t)?t:void 0,r=t=>t?.toString(),v=(t,e)=>{let s=parseInt(r(t));return f(s)?s:$(e)?e():f(e)?e:NaN},E=(...t)=>t.length>1?t:J(t[0])?t[0]:a(t[0])?[t[0]]:[];var u=(t,...e)=>r($(t)?t(...e):t);var R=class t{constructor(e,s=!1,n=""){this.subject=e;this.failed=s;this.message=n}not(e,s){if(this.failed)return this;try{return new t(this.subject,!e(this.subject),u(s,this.subject))}catch(n){return new t(this.subject,!0,n.message)}}undefined(e,s){return this.not(()=>a(e(this.subject)),s)}else(e){return{pass:!this.failed,message:()=>this.failed?u(this.message):`${u(e,this.subject)}, which we did not expect.`}}},o=t=>new R(t);var i=(t,e)=>o(t).undefined(s=>s,"Response is unknown.").undefined(s=>s?.status?.id,()=>"Response does not have a status code").not(s=>s.status.id===e,s=>`Response does not have code '${e}', but has code '${s.status.id}' instead.`).else(`Response does have status code '${e}'.`),V=t=>i(t,200),P=t=>i(t,201),F=t=>i(t,204),I=t=>i(t,400),O=t=>i(t,401),D=t=>i(t,403),Y=t=>i(t,404),Q=t=>i(t,409),L=t=>i(t,500),H=t=>i(t,502),Z=(t,e)=>o(t).undefined(s=>s.status?.id,"Response did not have a status").not(s=>s.status.id===200,s=>`Response did not have status '200'. It had status '${s.status.id}' instead.`).undefined(s=>s?.body?.data?.items,"Response did not have any items.").not(s=>(s?.body?.data?.itemCount??0)>=e,s=>`Response did not have at least ${e} items. It only had ${s?.body?.data?.itemCount??0} items.`).else(`Response had status 200 and at least ${e} items`);expect.extend({toBeOk:V,toBeOkWithItems:Z,toBeCreated:P,toHaveNoContent:F,toBeNotFound:Y,toBeBadRequest:I,toBeUnauthorized:O,toBeForbidden:D,toBeConflict:Q,toBeInternalServerError:L,toHaveStatus:i,toBeBadGateway:H});var g=class t{constructor(e,s,n,c=!1,W=""){this.ctx=e;this.received=s;this.expected=n;this.failed=c;this.message=W}print(e){return(typeof e=="function"?e([this.received,this.expected]):e).replace("{r}",this.ctx.utils.printReceived(this.received)).replace("{e}",this.ctx.utils.printExpected(this.expected)).replace("{diff}",this.ctx.utils.diff(this.received,this.expected)??"")}not(e,s){if(this.failed)return this;try{return new t(this.ctx,this.received,this.expected,!e([this.received,this.expected]),this.print(s))}catch(n){return new t(this.ctx,this.received,this.expected,!0,n.message)}}undefined(e,s){return this.not(()=>a(e([this.received,this.expected])),this.print(s))}else(e="Expected {r} not to match with {e}, but it did."){return{pass:!this.failed,message:()=>this.failed?this.message:this.print(e)}}},Ce=(t,e,s)=>new g(t,e,s),B=(t,e,s)=>new g(t,e,s).undefined(([n])=>n,"Received array is undefined.").undefined(([,n])=>n,"Expected array is undefined.");var U="Results is not defined.",G="Results does not fail.",z=(t,e)=>t.results.some(s=>s.message===e),K=t=>"'"+t?.results.map(e=>e.message).join("', '")+"'",X=(t,e)=>o(t).undefined(s=>s,U).not(s=>z(s,e),s=>`Results does not have message '${e}', but it has messages ${K(s)} instead.`).else(`Succeeds with message ${e}`),_=t=>o(t).undefined(e=>e,U).not(e=>!e.isValid,G).else("Results does not fail"),ee=(t,e)=>o(t).undefined(s=>s,U).not(s=>!s.isValid,G).not(s=>z(s,e),s=>`Fails, but results does not have message '${e}', but it has messages ${K(s)} instead.`).else(`Fails with message '${e}'`);expect.extend({toResultWith:X,toFail:_,toFailWith:ee});var te=(t,e)=>o(t).undefined(s=>s,"Subject is undefined.").not(s=>s instanceof Array,"Subject is not an array.").not(s=>s.every(n=>n instanceof e),`Not all elements are of type '${e.name}'.`).else(`All elements in array are of type '${e.name}'`);expect.extend({toBeArrayOf:te});var se=(t,e,s)=>o(t).undefined(n=>n,"Subject is undefined.").not(n=>n instanceof Array,"Subject is not an array.").not(n=>n.length===s,n=>`Subject does not have ${s} elements, but ${n.length}.`).not(n=>n.every(c=>c instanceof e),`Not all elements are of type '${e.name}'.`).else(`Subject has ${s} elements, which are all of type '${e.name}'`);expect.extend({toBeArrayOfWithLength:se});var ne=(t,e,s)=>o(t).undefined(n=>n,"Tester is undefined").undefined(n=>n.url,"Tester does not contain a URL").undefined(()=>e,"Use case is undefined").not(n=>n.url.includes(`/${e?.app.id}`),n=>`We expected the tester to be at app '${e?.app.id}', but it is at '${n?.url}' instead.`).not(n=>n.url.includes(`/${e?.id}`),n=>`We expected the tester to be at use case '${e?.id}', but it is at '${n?.url}' instead.`).not(n=>n.url.includes(s?`/${s}`:""),n=>`We expected the path to contain '/42', but it is '${n?.url}' instead.`).else(n=>`The tester is at '${n?.url}'`);expect.extend({toBeAt:ne});var oe=(t,e)=>{let s=a(e)?`/${e}`:"";return`/${t.app.id}/${t.id}${s}`},re=(t,e,s)=>o(t).undefined(n=>n,"Tester is undefined").undefined(n=>n.url,"Tester does not contain a URL").undefined(()=>e,"Use case is undefined").not(n=>n.url.includes(oe(e,s)),n=>`We expected the tester to be at: '${oe(e,s)}', but it is at: '${n?.url}' instead.`).else(n=>`The tester is at '${n?.url}'`);expect.extend({toBeExactlyAt:re});var M={Yes:"Match fails, instead of passes.",No:t=>`Match doesn't fail, because '${t}'`},N={Yes:"Match fails with correct message.",No:(t,e)=>`Match does fail, however not with message '${t}', but with message '${e}' instead.`},ae=t=>o(t).not(e=>!e.pass,e=>M.No(e.message())).else(M.Yes),ie=(t,e)=>o(t).not(s=>!s.pass,s=>M.No(s.message())).not(s=>s.message().includes(u(e)),s=>N.No(u(e),s.message())).else(N.Yes);expect.extend({toFailMatcher:ae,toFailMatcherWith:ie});var ce=t=>o(t).undefined(e=>e,"Subject is undefined.").not(e=>A(e,"isValid"),"Subject is not validatable.").not(e=>e.isValid,"Subject is not valid.").else("Subject is valid");expect.extend({toBeValid:ce});function ue(t,e){return B(this,t,e).not(([s,n])=>s.length===n.length,([s,n])=>`Received array has length ${s.length}, while expected array has length ${n.length}.`).not(([s,n])=>s.every((c,W)=>this.equals(c,n[W])),`Elements in {r} do not match elements in {e}.
2
-
3
- {diff}.`).else()}expect.extend({toMatchArray:ue});var p=require("@jest/expect-utils"),h={exact:(t,e)=>(0,p.equals)(t,e,[]),subset:(t,e)=>(0,p.equals)(t,e,[p.iterableEquality,p.subsetEquality]),string:(t,e)=>r(t)===r(e)};var x={SubjectUndefined:"Subject is undefined.",SubsetUndefined:"Object to match with is undefined.",DoesNotMatch:"Object does not exactly match subject.",Yes:"Object matches subject exactly"},de=(t,e)=>o(t).undefined(s=>s,x.SubjectUndefined).undefined(()=>e,x.SubsetUndefined).not(s=>h.exact(s,e),x.DoesNotMatch).else(()=>x.Yes);expect.extend({toMatchExactJson:de});var pe=(t,e,s)=>o(e).undefined(n=>n.id,"Expected value is not an exception.").not(n=>n.id===t.id,n=>`Expected exception has id '${n.id}', while the received exception has id '${t.id}'.`).not(()=>!a(s)||a(s)&&a(t.reason),()=>`We expected to have reason '${s}', but we received no reason.`).not(()=>!a(s)||a(s)&&t.reason===s,()=>`We expected to have reason '${s}', but we received reason '${t.reason}'.`).else("Expected exception matches received exception");expect.extend({toMatchException:pe});var y={SubjectUndefined:"Subject is undefined.",SubsetUndefined:"Subset to match with is undefined.",DoesNotMatch:"Subset does not match subject.",Yes:"Subset matches subject"},le=(t,e)=>o(t).undefined(s=>s,y.SubjectUndefined).undefined(()=>e,y.SubsetUndefined).not(s=>h.subset(m(s),m(e)),y.DoesNotMatch).else(()=>y.Yes);expect.extend({toMatchJson:le});var me=(t,e)=>o(t).undefined(s=>s,"Subject is undefined.").undefined(()=>e,"Route to include is undefined.").not(s=>r(s).includes(r(e)),s=>`Uri '${s}' does not include '${e}'.`).else(s=>`Uri '${s}' includes '${e}'`);expect.extend({toMatchRoute:me});var he=(t,e)=>o(t).undefined(s=>s,"Subject is undefined.").undefined(()=>e,"Text to match with is undefined.").not(s=>r(s)===r(e),s=>`Text '${s}' does not match with text '${e}'.`).else(s=>`Text '${s}' matches`);expect.extend({toMatchText:he});var b={Yes:"Match passes, instead of fails.",No:t=>`Match doesn't pass, because '${t}'`},q={Yes:"Match passes with correct message.",No:(t,e)=>`Match does pass, however not with message '${t}', but with message '${e}' instead.`},fe=t=>o(t).not(e=>e.pass,e=>b.No(e.message())).else(b.Yes),xe=(t,e)=>o(t).not(s=>s.pass,s=>b.No(s.message())).not(s=>s.message().includes(u(e)),s=>q.No(u(e),s.message())).else(q.Yes);expect.extend({toPassMatcher:fe,toPassMatcherWith:xe});var ye=(t,e)=>o(t?.mock?.calls).undefined(s=>s,"Query is unknown.").not(s=>s.length===1,"Query did not execute.").not(s=>s[0][0].toString()===e?.toString(),s=>`We expected query '${e}', but we received query '${s[0][0]}' instead.`).else(`Received query does match '${e}'`);expect.extend({toBeQueriedWith:ye});var Re=(t,e)=>o(t?.mock?.calls).undefined(s=>s,"Uri is unknown.").not(s=>s.length===1,"Method was not called.").not(s=>r(s[0][0])===r(e),s=>`We expected uri '${r(e)}', but we received uri '${r(s[0][0])}' instead.`).else(`Called uri does match '${r(e)}'`);expect.extend({toBeRoutedTo:Re});var k=require("expect"),j=class extends k.AsymmetricMatcher{asymmetricMatch(e){return r(e).includes(r(this.sample))}toString(){return`String${this.inverse?"Not":""}Containing`}},S=class extends k.AsymmetricMatcher{asymmetricMatch(e){return r(e)===r(this.sample)}toString(){return`String${this.inverse?"Not":""}Containing`}},w=class extends k.AsymmetricMatcher{asymmetricMatch(e){return h.subset(m(e),m(this.sample))}toString(){return`Object${this.inverse?"Not":""}Containing`}},ge={any:()=>expect.anything(),type:t=>expect.any(t),with:t=>expect.objectContaining(t),text:t=>new j(t),textExact:t=>new S(t),uri:t=>ge.textExact(t),json:t=>new w(t),items:(...t)=>expect.arrayContaining(E(...t))};var d=class{constructor(e={}){this.state=e}get id(){return this.state.id??this.path.id}get q(){return this.state.q??this.query.q}get path(){return this.state?.path??{}}get query(){return this.state?.query??{}}get skip(){return f(this.query?.skip)?v(this.query?.skip):void 0}get take(){return f(this.query?.take)?v(this.query?.take):void 0}get body(){return this.state.body}get headers(){return this.state.headers}get=e=>this?.state[e.toString()]??this.path[e.toString()]??this.query[e.toString()]};var T=class{clear=()=>jest.clearAllMocks();impl=e=>jest.fn().mockImplementation(e);property=(e,s,n)=>jest.spyOn(e,s,"get").mockReturnValue(n);reject=e=>jest.fn().mockRejectedValue(e);rejectWith=(e={})=>jest.fn().mockRejectedValue(l.a(e));req={id:e=>new d({id:e}),q:e=>new d({q:e}),with:e=>new d(e),body:e=>new d({body:e}),path:e=>new d({path:e}),query:e=>new d({query:e})};resp={items:(e,s=[])=>({status:e,body:{data:{code:e.id,itemCount:s.length,items:s}}}),errors:(e,s,n=[])=>({status:e,body:{error:{code:e.id,message:s,errorCount:n.length,errors:n}}})};resolve=e=>jest.fn().mockResolvedValue(e);resolveWith=(e={})=>jest.fn().mockResolvedValue(l.a(e));return=e=>jest.fn().mockReturnValue(e);returnWith=(e={})=>jest.fn().mockReturnValue(l.a(e));this=()=>jest.fn().mockReturnThis();provider={data:(...e)=>({execute:jest.fn().mockResolvedValue({body:{data:{itemCount:e.length,items:e}}})})};empty=(e={})=>e;a=this.empty;an=this.empty;date=(e=1621347575)=>{let s=new Date(e);return s.toString=l.return("Mon Jan 19 1970 19:22:27 GMT+0100 (Central European Standard Time)"),s.toLocaleDateString=l.return("19/01/1970"),s.toDateString=l.return("19/01/1970"),s};once=(...e)=>e.reduce((s,n)=>s.mockImplementationOnce(()=>n),jest.fn())},l=new T;0&&(module.exports={Fails,FailsWith,Match,MatchesExactJson,MatchesJson,Mocks,ObjectContainingJson,ObjectContainingText,ObjectContainingTextExact,Passes,PassesWith,check,checkDefined,fits,match,mock,toBeArrayOf,toBeArrayOfWithLength,toBeAt,toBeBadGateway,toBeBadRequest,toBeConflict,toBeCreated,toBeExactlyAt,toBeForbidden,toBeInternalServerError,toBeNotFound,toBeOk,toBeOkWithItems,toBeQueriedWith,toBeRoutedTo,toBeUnauthorized,toBeValid,toFail,toFailMatcher,toFailMatcherWith,toFailWith,toHaveNoContent,toHaveStatus,toMatchArray,toMatchExactJson,toMatchException,toMatchJson,toMatchRoute,toMatchText,toPassMatcher,toPassMatcherWith,toResultWith});
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 src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./matchers"), module.exports);
19
+ __reExport(src_exports, require("./mock"), module.exports);
20
+ // Annotate the CommonJS export names for ESM import in node:
21
+ 0 && (module.exports = {
22
+ ...require("./matchers"),
23
+ ...require("./mock")
24
+ });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './matchers';\nexport * from './mock';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,uBAAd;AACA,wBAAc,mBADd;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- var a=t=>t!=null,m=t=>a(t)&&typeof t=="number"&&!Number.isNaN(t),R=t=>a(t)&&typeof t=="function",B=(t,...e)=>a(t)&&e.every(s=>a(t[s]));var U=t=>a(t)&&t instanceof Array,I=t=>t!=null&&(typeof t=="object"||typeof t=="function")&&!U(t),d=t=>t?.toJSON?t.toJSON():I(t)?t:void 0,r=t=>t?.toString(),g=(t,e)=>{let s=parseInt(r(t));return m(s)?s:R(e)?e():m(e)?e:NaN},N=(...t)=>t.length>1?t:U(t[0])?t[0]:a(t[0])?[t[0]]:[];var c=(t,...e)=>r(R(t)?t(...e):t);var M=class t{constructor(e,s=!1,n=""){this.subject=e;this.failed=s;this.message=n}not(e,s){if(this.failed)return this;try{return new t(this.subject,!e(this.subject),c(s,this.subject))}catch(n){return new t(this.subject,!0,n.message)}}undefined(e,s){return this.not(()=>a(e(this.subject)),s)}else(e){return{pass:!this.failed,message:()=>this.failed?c(this.message):`${c(e,this.subject)}, which we did not expect.`}}},o=t=>new M(t);var i=(t,e)=>o(t).undefined(s=>s,"Response is unknown.").undefined(s=>s?.status?.id,()=>"Response does not have a status code").not(s=>s.status.id===e,s=>`Response does not have code '${e}', but has code '${s.status.id}' instead.`).else(`Response does have status code '${e}'.`),O=t=>i(t,200),D=t=>i(t,201),Y=t=>i(t,204),Q=t=>i(t,400),L=t=>i(t,401),H=t=>i(t,403),Z=t=>i(t,404),G=t=>i(t,409),z=t=>i(t,500),K=t=>i(t,502),X=(t,e)=>o(t).undefined(s=>s.status?.id,"Response did not have a status").not(s=>s.status.id===200,s=>`Response did not have status '200'. It had status '${s.status.id}' instead.`).undefined(s=>s?.body?.data?.items,"Response did not have any items.").not(s=>(s?.body?.data?.itemCount??0)>=e,s=>`Response did not have at least ${e} items. It only had ${s?.body?.data?.itemCount??0} items.`).else(`Response had status 200 and at least ${e} items`);expect.extend({toBeOk:O,toBeOkWithItems:X,toBeCreated:D,toHaveNoContent:Y,toBeNotFound:Z,toBeBadRequest:Q,toBeUnauthorized:L,toBeForbidden:H,toBeConflict:G,toBeInternalServerError:z,toHaveStatus:i,toBeBadGateway:K});var f=class t{constructor(e,s,n,h=!1,v=""){this.ctx=e;this.received=s;this.expected=n;this.failed=h;this.message=v}print(e){return(typeof e=="function"?e([this.received,this.expected]):e).replace("{r}",this.ctx.utils.printReceived(this.received)).replace("{e}",this.ctx.utils.printExpected(this.expected)).replace("{diff}",this.ctx.utils.diff(this.received,this.expected)??"")}not(e,s){if(this.failed)return this;try{return new t(this.ctx,this.received,this.expected,!e([this.received,this.expected]),this.print(s))}catch(n){return new t(this.ctx,this.received,this.expected,!0,n.message)}}undefined(e,s){return this.not(()=>a(e([this.received,this.expected])),this.print(s))}else(e="Expected {r} not to match with {e}, but it did."){return{pass:!this.failed,message:()=>this.failed?this.message:this.print(e)}}},Ne=(t,e,s)=>new f(t,e,s),q=(t,e,s)=>new f(t,e,s).undefined(([n])=>n,"Received array is undefined.").undefined(([,n])=>n,"Expected array is undefined.");var b="Results is not defined.",W="Results does not fail.",A=(t,e)=>t.results.some(s=>s.message===e),J=t=>"'"+t?.results.map(e=>e.message).join("', '")+"'",_=(t,e)=>o(t).undefined(s=>s,b).not(s=>A(s,e),s=>`Results does not have message '${e}', but it has messages ${J(s)} instead.`).else(`Succeeds with message ${e}`),ee=t=>o(t).undefined(e=>e,b).not(e=>!e.isValid,W).else("Results does not fail"),te=(t,e)=>o(t).undefined(s=>s,b).not(s=>!s.isValid,W).not(s=>A(s,e),s=>`Fails, but results does not have message '${e}', but it has messages ${J(s)} instead.`).else(`Fails with message '${e}'`);expect.extend({toResultWith:_,toFail:ee,toFailWith:te});var se=(t,e)=>o(t).undefined(s=>s,"Subject is undefined.").not(s=>s instanceof Array,"Subject is not an array.").not(s=>s.every(n=>n instanceof e),`Not all elements are of type '${e.name}'.`).else(`All elements in array are of type '${e.name}'`);expect.extend({toBeArrayOf:se});var ne=(t,e,s)=>o(t).undefined(n=>n,"Subject is undefined.").not(n=>n instanceof Array,"Subject is not an array.").not(n=>n.length===s,n=>`Subject does not have ${s} elements, but ${n.length}.`).not(n=>n.every(h=>h instanceof e),`Not all elements are of type '${e.name}'.`).else(`Subject has ${s} elements, which are all of type '${e.name}'`);expect.extend({toBeArrayOfWithLength:ne});var oe=(t,e,s)=>o(t).undefined(n=>n,"Tester is undefined").undefined(n=>n.url,"Tester does not contain a URL").undefined(()=>e,"Use case is undefined").not(n=>n.url.includes(`/${e?.app.id}`),n=>`We expected the tester to be at app '${e?.app.id}', but it is at '${n?.url}' instead.`).not(n=>n.url.includes(`/${e?.id}`),n=>`We expected the tester to be at use case '${e?.id}', but it is at '${n?.url}' instead.`).not(n=>n.url.includes(s?`/${s}`:""),n=>`We expected the path to contain '/42', but it is '${n?.url}' instead.`).else(n=>`The tester is at '${n?.url}'`);expect.extend({toBeAt:oe});var E=(t,e)=>{let s=a(e)?`/${e}`:"";return`/${t.app.id}/${t.id}${s}`},re=(t,e,s)=>o(t).undefined(n=>n,"Tester is undefined").undefined(n=>n.url,"Tester does not contain a URL").undefined(()=>e,"Use case is undefined").not(n=>n.url.includes(E(e,s)),n=>`We expected the tester to be at: '${E(e,s)}', but it is at: '${n?.url}' instead.`).else(n=>`The tester is at '${n?.url}'`);expect.extend({toBeExactlyAt:re});var j={Yes:"Match fails, instead of passes.",No:t=>`Match doesn't fail, because '${t}'`},V={Yes:"Match fails with correct message.",No:(t,e)=>`Match does fail, however not with message '${t}', but with message '${e}' instead.`},ae=t=>o(t).not(e=>!e.pass,e=>j.No(e.message())).else(j.Yes),ie=(t,e)=>o(t).not(s=>!s.pass,s=>j.No(s.message())).not(s=>s.message().includes(c(e)),s=>V.No(c(e),s.message())).else(V.Yes);expect.extend({toFailMatcher:ae,toFailMatcherWith:ie});var ce=t=>o(t).undefined(e=>e,"Subject is undefined.").not(e=>B(e,"isValid"),"Subject is not validatable.").not(e=>e.isValid,"Subject is not valid.").else("Subject is valid");expect.extend({toBeValid:ce});function ue(t,e){return q(this,t,e).not(([s,n])=>s.length===n.length,([s,n])=>`Received array has length ${s.length}, while expected array has length ${n.length}.`).not(([s,n])=>s.every((h,v)=>this.equals(h,n[v])),`Elements in {r} do not match elements in {e}.
2
-
3
- {diff}.`).else()}expect.extend({toMatchArray:ue});import{equals as P,iterableEquality as de,subsetEquality as pe}from"@jest/expect-utils";var p={exact:(t,e)=>P(t,e,[]),subset:(t,e)=>P(t,e,[de,pe]),string:(t,e)=>r(t)===r(e)};var x={SubjectUndefined:"Subject is undefined.",SubsetUndefined:"Object to match with is undefined.",DoesNotMatch:"Object does not exactly match subject.",Yes:"Object matches subject exactly"},le=(t,e)=>o(t).undefined(s=>s,x.SubjectUndefined).undefined(()=>e,x.SubsetUndefined).not(s=>p.exact(s,e),x.DoesNotMatch).else(()=>x.Yes);expect.extend({toMatchExactJson:le});var me=(t,e,s)=>o(e).undefined(n=>n.id,"Expected value is not an exception.").not(n=>n.id===t.id,n=>`Expected exception has id '${n.id}', while the received exception has id '${t.id}'.`).not(()=>!a(s)||a(s)&&a(t.reason),()=>`We expected to have reason '${s}', but we received no reason.`).not(()=>!a(s)||a(s)&&t.reason===s,()=>`We expected to have reason '${s}', but we received reason '${t.reason}'.`).else("Expected exception matches received exception");expect.extend({toMatchException:me});var y={SubjectUndefined:"Subject is undefined.",SubsetUndefined:"Subset to match with is undefined.",DoesNotMatch:"Subset does not match subject.",Yes:"Subset matches subject"},he=(t,e)=>o(t).undefined(s=>s,y.SubjectUndefined).undefined(()=>e,y.SubsetUndefined).not(s=>p.subset(d(s),d(e)),y.DoesNotMatch).else(()=>y.Yes);expect.extend({toMatchJson:he});var fe=(t,e)=>o(t).undefined(s=>s,"Subject is undefined.").undefined(()=>e,"Route to include is undefined.").not(s=>r(s).includes(r(e)),s=>`Uri '${s}' does not include '${e}'.`).else(s=>`Uri '${s}' includes '${e}'`);expect.extend({toMatchRoute:fe});var xe=(t,e)=>o(t).undefined(s=>s,"Subject is undefined.").undefined(()=>e,"Text to match with is undefined.").not(s=>r(s)===r(e),s=>`Text '${s}' does not match with text '${e}'.`).else(s=>`Text '${s}' matches`);expect.extend({toMatchText:xe});var S={Yes:"Match passes, instead of fails.",No:t=>`Match doesn't pass, because '${t}'`},F={Yes:"Match passes with correct message.",No:(t,e)=>`Match does pass, however not with message '${t}', but with message '${e}' instead.`},ye=t=>o(t).not(e=>e.pass,e=>S.No(e.message())).else(S.Yes),Re=(t,e)=>o(t).not(s=>s.pass,s=>S.No(s.message())).not(s=>s.message().includes(c(e)),s=>F.No(c(e),s.message())).else(F.Yes);expect.extend({toPassMatcher:ye,toPassMatcherWith:Re});var ge=(t,e)=>o(t?.mock?.calls).undefined(s=>s,"Query is unknown.").not(s=>s.length===1,"Query did not execute.").not(s=>s[0][0].toString()===e?.toString(),s=>`We expected query '${e}', but we received query '${s[0][0]}' instead.`).else(`Received query does match '${e}'`);expect.extend({toBeQueriedWith:ge});var Me=(t,e)=>o(t?.mock?.calls).undefined(s=>s,"Uri is unknown.").not(s=>s.length===1,"Method was not called.").not(s=>r(s[0][0])===r(e),s=>`We expected uri '${r(e)}', but we received uri '${r(s[0][0])}' instead.`).else(`Called uri does match '${r(e)}'`);expect.extend({toBeRoutedTo:Me});import{AsymmetricMatcher as C}from"expect";var w=class extends C{asymmetricMatch(e){return r(e).includes(r(this.sample))}toString(){return`String${this.inverse?"Not":""}Containing`}},k=class extends C{asymmetricMatch(e){return r(e)===r(this.sample)}toString(){return`String${this.inverse?"Not":""}Containing`}},T=class extends C{asymmetricMatch(e){return p.subset(d(e),d(this.sample))}toString(){return`Object${this.inverse?"Not":""}Containing`}},be={any:()=>expect.anything(),type:t=>expect.any(t),with:t=>expect.objectContaining(t),text:t=>new w(t),textExact:t=>new k(t),uri:t=>be.textExact(t),json:t=>new T(t),items:(...t)=>expect.arrayContaining(N(...t))};var u=class{constructor(e={}){this.state=e}get id(){return this.state.id??this.path.id}get q(){return this.state.q??this.query.q}get path(){return this.state?.path??{}}get query(){return this.state?.query??{}}get skip(){return m(this.query?.skip)?g(this.query?.skip):void 0}get take(){return m(this.query?.take)?g(this.query?.take):void 0}get body(){return this.state.body}get headers(){return this.state.headers}get=e=>this?.state[e.toString()]??this.path[e.toString()]??this.query[e.toString()]};var $=class{clear=()=>jest.clearAllMocks();impl=e=>jest.fn().mockImplementation(e);property=(e,s,n)=>jest.spyOn(e,s,"get").mockReturnValue(n);reject=e=>jest.fn().mockRejectedValue(e);rejectWith=(e={})=>jest.fn().mockRejectedValue(l.a(e));req={id:e=>new u({id:e}),q:e=>new u({q:e}),with:e=>new u(e),body:e=>new u({body:e}),path:e=>new u({path:e}),query:e=>new u({query:e})};resp={items:(e,s=[])=>({status:e,body:{data:{code:e.id,itemCount:s.length,items:s}}}),errors:(e,s,n=[])=>({status:e,body:{error:{code:e.id,message:s,errorCount:n.length,errors:n}}})};resolve=e=>jest.fn().mockResolvedValue(e);resolveWith=(e={})=>jest.fn().mockResolvedValue(l.a(e));return=e=>jest.fn().mockReturnValue(e);returnWith=(e={})=>jest.fn().mockReturnValue(l.a(e));this=()=>jest.fn().mockReturnThis();provider={data:(...e)=>({execute:jest.fn().mockResolvedValue({body:{data:{itemCount:e.length,items:e}}})})};empty=(e={})=>e;a=this.empty;an=this.empty;date=(e=1621347575)=>{let s=new Date(e);return s.toString=l.return("Mon Jan 19 1970 19:22:27 GMT+0100 (Central European Standard Time)"),s.toLocaleDateString=l.return("19/01/1970"),s.toDateString=l.return("19/01/1970"),s};once=(...e)=>e.reduce((s,n)=>s.mockImplementationOnce(()=>n),jest.fn())},l=new $;export{j as Fails,V as FailsWith,M as Match,x as MatchesExactJson,y as MatchesJson,$ as Mocks,T as ObjectContainingJson,w as ObjectContainingText,k as ObjectContainingTextExact,S as Passes,F as PassesWith,Ne as check,q as checkDefined,be as fits,o as match,l as mock,se as toBeArrayOf,ne as toBeArrayOfWithLength,oe as toBeAt,K as toBeBadGateway,Q as toBeBadRequest,G as toBeConflict,D as toBeCreated,re as toBeExactlyAt,H as toBeForbidden,z as toBeInternalServerError,Z as toBeNotFound,O as toBeOk,X as toBeOkWithItems,ge as toBeQueriedWith,Me as toBeRoutedTo,L as toBeUnauthorized,ce as toBeValid,ee as toFail,ae as toFailMatcher,ie as toFailMatcherWith,te as toFailWith,Y as toHaveNoContent,i as toHaveStatus,ue as toMatchArray,le as toMatchExactJson,me as toMatchException,he as toMatchJson,fe as toMatchRoute,xe as toMatchText,ye as toPassMatcher,Re as toPassMatcherWith,_ as toResultWith};
1
+ export * from "./matchers";
2
+ export * from "./mock";
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './matchers';\nexport * from './mock';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,17 @@
1
+ /// <reference types="jest" />
2
+ type ToMessage<S> = string | ((s: S[]) => string);
3
+ declare class Check<S> {
4
+ private ctx;
5
+ private readonly received;
6
+ private readonly expected;
7
+ private readonly failed;
8
+ private readonly message;
9
+ constructor(ctx: jest.MatcherContext, received: S, expected: S, failed?: boolean, message?: string);
10
+ print(message: ToMessage<S>): string;
11
+ not(p: (s: S[]) => boolean, message: ToMessage<S>): Check<S>;
12
+ undefined(p: (s: S[]) => any, message: ToMessage<S>): Check<S>;
13
+ else(message?: ToMessage<S>): jest.CustomMatcherResult;
14
+ }
15
+ export declare const check: <S>(ctx: jest.MatcherContext, received: S, expected?: S | undefined) => Check<S>;
16
+ export declare const checkDefined: <S>(ctx: jest.MatcherContext, received: S, expected?: S | undefined) => Check<S>;
17
+ export {};
@@ -0,0 +1,64 @@
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 Check_exports = {};
20
+ __export(Check_exports, {
21
+ check: () => check,
22
+ checkDefined: () => checkDefined
23
+ });
24
+ module.exports = __toCommonJS(Check_exports);
25
+ var import_Utils = require("../utils/Utils");
26
+ class Check {
27
+ constructor(ctx, received, expected, failed = false, message = "") {
28
+ this.ctx = ctx;
29
+ this.received = received;
30
+ this.expected = expected;
31
+ this.failed = failed;
32
+ this.message = message;
33
+ }
34
+ print(message) {
35
+ return (typeof message === "function" ? message([this.received, this.expected]) : message).replace("{r}", this.ctx.utils.printReceived(this.received)).replace("{e}", this.ctx.utils.printExpected(this.expected)).replace("{diff}", this.ctx.utils.diff(this.received, this.expected) ?? "");
36
+ }
37
+ not(p, message) {
38
+ if (this.failed) {
39
+ return this;
40
+ }
41
+ try {
42
+ return new Check(this.ctx, this.received, this.expected, !p([this.received, this.expected]), this.print(message));
43
+ } catch (e) {
44
+ return new Check(this.ctx, this.received, this.expected, true, e.message);
45
+ }
46
+ }
47
+ undefined(p, message) {
48
+ return this.not(() => (0, import_Utils.isDefined)(p([this.received, this.expected])), this.print(message));
49
+ }
50
+ else(message = "Expected {r} not to match with {e}, but it did.") {
51
+ return {
52
+ pass: !this.failed,
53
+ message: () => this.failed ? this.message : this.print(message)
54
+ };
55
+ }
56
+ }
57
+ const check = (ctx, received, expected) => new Check(ctx, received, expected);
58
+ const checkDefined = (ctx, received, expected) => new Check(ctx, received, expected).undefined(([r]) => r, "Received array is undefined.").undefined(([, e]) => e, "Expected array is undefined.");
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
61
+ check,
62
+ checkDefined
63
+ });
64
+ //# sourceMappingURL=Check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/Check.ts"],"sourcesContent":["import { isDefined } from '../utils/Utils';\n\ntype ToMessage<S> = string | ((s: S[]) => string);\n\nclass Check<S> {\n constructor(\n private ctx: jest.MatcherContext,\n private readonly received: S,\n private readonly expected: S,\n private readonly failed = false,\n private readonly message = ''\n ) {}\n\n print(message: ToMessage<S>): string {\n return (typeof message === 'function' ? message([this.received, this.expected]) : message)\n .replace('{r}', this.ctx.utils.printReceived(this.received))\n .replace('{e}', this.ctx.utils.printExpected(this.expected))\n .replace('{diff}', this.ctx.utils.diff(this.received, this.expected) ?? '');\n }\n\n not(p: (s: S[]) => boolean, message: ToMessage<S>): Check<S> {\n if (this.failed) {\n return this;\n }\n try {\n return new Check<S>(this.ctx, this.received, this.expected, !p([this.received, this.expected]), this.print(message));\n } catch (e: any) {\n return new Check<S>(this.ctx, this.received, this.expected, true, e.message);\n }\n }\n\n undefined(p: (s: S[]) => any, message: ToMessage<S>): Check<S> {\n return this.not(() => isDefined(p([this.received, this.expected])), this.print(message));\n }\n\n else(message: ToMessage<S> = 'Expected {r} not to match with {e}, but it did.'): jest.CustomMatcherResult {\n return {\n pass: !this.failed,\n message: () => (this.failed ? this.message : this.print(message)),\n };\n }\n}\n\nexport const check = <S>(ctx: jest.MatcherContext, received: S, expected?: S): Check<S> => new Check<S>(ctx, received, expected as S);\n\nexport const checkDefined = <S>(ctx: jest.MatcherContext, received: S, expected?: S): Check<S> =>\n new Check<S>(ctx, received, expected as S).undefined(([r]) => r, 'Received array is undefined.').undefined(([, e]) => e, 'Expected array is undefined.');\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAI1B,MAAM,MAAS;AAAA,EACb,YACU,KACS,UACA,UACA,SAAS,OACT,UAAU,IAC3B;AALQ;AACS;AACA;AACA;AACA;AAAA,EAChB;AAAA,EAEH,MAAM,SAA+B;AACnC,YAAQ,OAAO,YAAY,aAAa,QAAQ,CAAC,KAAK,UAAU,KAAK,QAAQ,CAAC,IAAI,SAC/E,QAAQ,OAAO,KAAK,IAAI,MAAM,cAAc,KAAK,QAAQ,CAAC,EAC1D,QAAQ,OAAO,KAAK,IAAI,MAAM,cAAc,KAAK,QAAQ,CAAC,EAC1D,QAAQ,UAAU,KAAK,IAAI,MAAM,KAAK,KAAK,UAAU,KAAK,QAAQ,KAAK,EAAE;AAAA,EAC9E;AAAA,EAEA,IAAI,GAAwB,SAAiC;AAC3D,QAAI,KAAK,QAAQ;AACf,aAAO;AAAA,IACT;AACA,QAAI;AACF,aAAO,IAAI,MAAS,KAAK,KAAK,KAAK,UAAU,KAAK,UAAU,CAAC,EAAE,CAAC,KAAK,UAAU,KAAK,QAAQ,CAAC,GAAG,KAAK,MAAM,OAAO,CAAC;AAAA,IACrH,SAAS,GAAQ;AACf,aAAO,IAAI,MAAS,KAAK,KAAK,KAAK,UAAU,KAAK,UAAU,MAAM,EAAE,OAAO;AAAA,IAC7E;AAAA,EACF;AAAA,EAEA,UAAU,GAAoB,SAAiC;AAC7D,WAAO,KAAK,IAAI,UAAM,wBAAU,EAAE,CAAC,KAAK,UAAU,KAAK,QAAQ,CAAC,CAAC,GAAG,KAAK,MAAM,OAAO,CAAC;AAAA,EACzF;AAAA,EAEA,KAAK,UAAwB,mDAA6E;AACxG,WAAO;AAAA,MACL,MAAM,CAAC,KAAK;AAAA,MACZ,SAAS,MAAO,KAAK,SAAS,KAAK,UAAU,KAAK,MAAM,OAAO;AAAA,IACjE;AAAA,EACF;AACF;AAEO,MAAM,QAAQ,CAAI,KAA0B,UAAa,aAA2B,IAAI,MAAS,KAAK,UAAU,QAAa;AAE7H,MAAM,eAAe,CAAI,KAA0B,UAAa,aACrE,IAAI,MAAS,KAAK,UAAU,QAAa,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,8BAA8B,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,8BAA8B;","names":[]}
@@ -0,0 +1,39 @@
1
+ import { isDefined } from "../utils/Utils";
2
+ class Check {
3
+ constructor(ctx, received, expected, failed = false, message = "") {
4
+ this.ctx = ctx;
5
+ this.received = received;
6
+ this.expected = expected;
7
+ this.failed = failed;
8
+ this.message = message;
9
+ }
10
+ print(message) {
11
+ return (typeof message === "function" ? message([this.received, this.expected]) : message).replace("{r}", this.ctx.utils.printReceived(this.received)).replace("{e}", this.ctx.utils.printExpected(this.expected)).replace("{diff}", this.ctx.utils.diff(this.received, this.expected) ?? "");
12
+ }
13
+ not(p, message) {
14
+ if (this.failed) {
15
+ return this;
16
+ }
17
+ try {
18
+ return new Check(this.ctx, this.received, this.expected, !p([this.received, this.expected]), this.print(message));
19
+ } catch (e) {
20
+ return new Check(this.ctx, this.received, this.expected, true, e.message);
21
+ }
22
+ }
23
+ undefined(p, message) {
24
+ return this.not(() => isDefined(p([this.received, this.expected])), this.print(message));
25
+ }
26
+ else(message = "Expected {r} not to match with {e}, but it did.") {
27
+ return {
28
+ pass: !this.failed,
29
+ message: () => this.failed ? this.message : this.print(message)
30
+ };
31
+ }
32
+ }
33
+ const check = (ctx, received, expected) => new Check(ctx, received, expected);
34
+ const checkDefined = (ctx, received, expected) => new Check(ctx, received, expected).undefined(([r]) => r, "Received array is undefined.").undefined(([, e]) => e, "Expected array is undefined.");
35
+ export {
36
+ check,
37
+ checkDefined
38
+ };
39
+ //# sourceMappingURL=Check.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/matchers/Check.ts"],"sourcesContent":["import { isDefined } from '../utils/Utils';\n\ntype ToMessage<S> = string | ((s: S[]) => string);\n\nclass Check<S> {\n constructor(\n private ctx: jest.MatcherContext,\n private readonly received: S,\n private readonly expected: S,\n private readonly failed = false,\n private readonly message = ''\n ) {}\n\n print(message: ToMessage<S>): string {\n return (typeof message === 'function' ? message([this.received, this.expected]) : message)\n .replace('{r}', this.ctx.utils.printReceived(this.received))\n .replace('{e}', this.ctx.utils.printExpected(this.expected))\n .replace('{diff}', this.ctx.utils.diff(this.received, this.expected) ?? '');\n }\n\n not(p: (s: S[]) => boolean, message: ToMessage<S>): Check<S> {\n if (this.failed) {\n return this;\n }\n try {\n return new Check<S>(this.ctx, this.received, this.expected, !p([this.received, this.expected]), this.print(message));\n } catch (e: any) {\n return new Check<S>(this.ctx, this.received, this.expected, true, e.message);\n }\n }\n\n undefined(p: (s: S[]) => any, message: ToMessage<S>): Check<S> {\n return this.not(() => isDefined(p([this.received, this.expected])), this.print(message));\n }\n\n else(message: ToMessage<S> = 'Expected {r} not to match with {e}, but it did.'): jest.CustomMatcherResult {\n return {\n pass: !this.failed,\n message: () => (this.failed ? this.message : this.print(message)),\n };\n }\n}\n\nexport const check = <S>(ctx: jest.MatcherContext, received: S, expected?: S): Check<S> => new Check<S>(ctx, received, expected as S);\n\nexport const checkDefined = <S>(ctx: jest.MatcherContext, received: S, expected?: S): Check<S> =>\n new Check<S>(ctx, received, expected as S).undefined(([r]) => r, 'Received array is undefined.').undefined(([, e]) => e, 'Expected array is undefined.');\n"],"mappings":"AAAA,SAAS,iBAAiB;AAI1B,MAAM,MAAS;AAAA,EACb,YACU,KACS,UACA,UACA,SAAS,OACT,UAAU,IAC3B;AALQ;AACS;AACA;AACA;AACA;AAAA,EAChB;AAAA,EAEH,MAAM,SAA+B;AACnC,YAAQ,OAAO,YAAY,aAAa,QAAQ,CAAC,KAAK,UAAU,KAAK,QAAQ,CAAC,IAAI,SAC/E,QAAQ,OAAO,KAAK,IAAI,MAAM,cAAc,KAAK,QAAQ,CAAC,EAC1D,QAAQ,OAAO,KAAK,IAAI,MAAM,cAAc,KAAK,QAAQ,CAAC,EAC1D,QAAQ,UAAU,KAAK,IAAI,MAAM,KAAK,KAAK,UAAU,KAAK,QAAQ,KAAK,EAAE;AAAA,EAC9E;AAAA,EAEA,IAAI,GAAwB,SAAiC;AAC3D,QAAI,KAAK,QAAQ;AACf,aAAO;AAAA,IACT;AACA,QAAI;AACF,aAAO,IAAI,MAAS,KAAK,KAAK,KAAK,UAAU,KAAK,UAAU,CAAC,EAAE,CAAC,KAAK,UAAU,KAAK,QAAQ,CAAC,GAAG,KAAK,MAAM,OAAO,CAAC;AAAA,IACrH,SAAS,GAAQ;AACf,aAAO,IAAI,MAAS,KAAK,KAAK,KAAK,UAAU,KAAK,UAAU,MAAM,EAAE,OAAO;AAAA,IAC7E;AAAA,EACF;AAAA,EAEA,UAAU,GAAoB,SAAiC;AAC7D,WAAO,KAAK,IAAI,MAAM,UAAU,EAAE,CAAC,KAAK,UAAU,KAAK,QAAQ,CAAC,CAAC,GAAG,KAAK,MAAM,OAAO,CAAC;AAAA,EACzF;AAAA,EAEA,KAAK,UAAwB,mDAA6E;AACxG,WAAO;AAAA,MACL,MAAM,CAAC,KAAK;AAAA,MACZ,SAAS,MAAO,KAAK,SAAS,KAAK,UAAU,KAAK,MAAM,OAAO;AAAA,IACjE;AAAA,EACF;AACF;AAEO,MAAM,QAAQ,CAAI,KAA0B,UAAa,aAA2B,IAAI,MAAS,KAAK,UAAU,QAAa;AAE7H,MAAM,eAAe,CAAI,KAA0B,UAAa,aACrE,IAAI,MAAS,KAAK,UAAU,QAAa,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,8BAA8B,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,8BAA8B;","names":[]}
@@ -0,0 +1,31 @@
1
+ import { Response } from '../utils/Response';
2
+ export declare const toHaveStatus: (res: Response, code: number) => jest.CustomMatcherResult;
3
+ export declare const toBeOk: (res: Response) => jest.CustomMatcherResult;
4
+ export declare const toBeCreated: (res: Response) => jest.CustomMatcherResult;
5
+ export declare const toHaveNoContent: (res: Response) => jest.CustomMatcherResult;
6
+ export declare const toBeBadRequest: (res: Response) => jest.CustomMatcherResult;
7
+ export declare const toBeUnauthorized: (res: Response) => jest.CustomMatcherResult;
8
+ export declare const toBeForbidden: (res: Response) => jest.CustomMatcherResult;
9
+ export declare const toBeNotFound: (res: Response) => jest.CustomMatcherResult;
10
+ export declare const toBeConflict: (res: Response) => jest.CustomMatcherResult;
11
+ export declare const toBeInternalServerError: (res: Response) => jest.CustomMatcherResult;
12
+ export declare const toBeBadGateway: (res: Response) => jest.CustomMatcherResult;
13
+ export declare const toBeOkWithItems: (res: Response, length: number) => jest.CustomMatcherResult;
14
+ declare global {
15
+ namespace jest {
16
+ interface Matchers<R, T> {
17
+ toBeOk(): R;
18
+ toBeOkWithItems(length: number): R;
19
+ toBeCreated(): R;
20
+ toHaveNoContent(): R;
21
+ toBeNotFound(): R;
22
+ toBeUnauthorized(): R;
23
+ toBeForbidden(): R;
24
+ toBeBadRequest(): R;
25
+ toBeConflict(): R;
26
+ toBeInternalServerError(): R;
27
+ toBeBadGateway(): R;
28
+ toHaveStatus(code: number): R;
29
+ }
30
+ }
31
+ }