@jaypie/testkit 1.1.26 → 1.1.28

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 (49) hide show
  1. package/dist/index.d.ts +241 -5
  2. package/dist/index.js +34 -16
  3. package/dist/index.js.map +1 -1
  4. package/dist/matchers/toBeMockFunction.matcher.d.ts +10 -0
  5. package/dist/matchers.module.d.ts +2 -0
  6. package/dist/mock/aws.d.ts +22 -0
  7. package/dist/mock/constants.d.ts +19 -0
  8. package/dist/mock/core.d.ts +307 -0
  9. package/dist/mock/datadog.d.ts +4 -0
  10. package/dist/mock/express.d.ts +32 -0
  11. package/dist/mock/index.d.ts +472 -0
  12. package/dist/mock/index.js +820 -0
  13. package/dist/mock/index.js.map +1 -0
  14. package/dist/mock/jsonApiSchema.module.d.ts +61 -0
  15. package/dist/mock/lambda.d.ts +15 -0
  16. package/dist/mock/llm.d.ts +67 -0
  17. package/dist/mock/matchers/toBeCalledAboveTrace.matcher.d.ts +3 -0
  18. package/dist/mock/matchers/toBeCalledWithInitialParams.matcher.d.ts +4 -0
  19. package/dist/mock/matchers/toBeClass.matcher.d.ts +3 -0
  20. package/dist/mock/matchers/toBeJaypieError.matcher.d.ts +3 -0
  21. package/dist/mock/matchers/toBeMockFunction.matcher.d.ts +10 -0
  22. package/dist/mock/matchers/toMatch.matcher.d.ts +12 -0
  23. package/dist/mock/matchers/toThrowError.matcher.d.ts +4 -0
  24. package/dist/mock/matchers/toThrowJaypieError.matcher.d.ts +16 -0
  25. package/dist/mock/matchers.module.d.ts +97 -0
  26. package/dist/mock/mock/aws.d.ts +22 -0
  27. package/dist/mock/mock/core.d.ts +307 -0
  28. package/dist/mock/mock/datadog.d.ts +4 -0
  29. package/dist/mock/mock/express.d.ts +32 -0
  30. package/dist/mock/mock/index.d.ts +10 -0
  31. package/dist/mock/mock/lambda.d.ts +15 -0
  32. package/dist/mock/mock/llm.d.ts +67 -0
  33. package/dist/mock/mock/mongoose.d.ts +4 -0
  34. package/dist/mock/mock/original.d.ts +19 -0
  35. package/dist/mock/mock/textract.d.ts +14 -0
  36. package/dist/mock/mock/utils.d.ts +42 -0
  37. package/dist/mock/mockLog.module.d.ts +5 -0
  38. package/dist/mock/mongoose.d.ts +4 -0
  39. package/dist/mock/original.d.ts +19 -0
  40. package/dist/mock/placeholders.d.ts +9 -0
  41. package/dist/mock/sqsTestRecords.function.d.ts +14 -0
  42. package/dist/mock/textract.d.ts +14 -0
  43. package/dist/mock/utils.d.ts +42 -0
  44. package/dist/mockLog.module.d.ts +3 -3
  45. package/dist/mockTextract.json +87 -752
  46. package/package.json +16 -8
  47. package/dist/jaypie.mock.d.ts +0 -70
  48. package/dist/jaypie.mock.js +0 -693
  49. package/dist/jaypie.mock.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,241 @@
1
- export { LOG } from "./constants.js";
2
- export { jsonApiErrorSchema, jsonApiSchema } from "./jsonApiSchema.module";
3
- export { default as matchers } from "./matchers.module";
4
- export { mockLogFactory, restoreLog, spyLog } from "./mockLog.module";
5
- export { default as sqsTestRecords } from "./sqsTestRecords.function";
1
+ import * as _jaypie_core from '@jaypie/core';
2
+ import { Log, log } from '@jaypie/core';
3
+ import * as jest_json_schema from 'jest-json-schema';
4
+ import * as vitest from 'vitest';
5
+ import { Mock, Assertion } from 'vitest';
6
+
7
+ declare const LOG: {
8
+ readonly LEVEL: {
9
+ readonly ALL: "all";
10
+ readonly DEBUG: "debug";
11
+ readonly ERROR: "error";
12
+ readonly FATAL: "fatal";
13
+ readonly INFO: "info";
14
+ readonly SILENT: "silent";
15
+ readonly TRACE: "trace";
16
+ readonly WARN: "warn";
17
+ };
18
+ };
19
+
20
+ interface MatcherResult {
21
+ message: () => string;
22
+ pass: boolean;
23
+ }
24
+
25
+ interface MockLogMethod extends Mock {
26
+ var: Mock;
27
+ }
28
+
29
+ interface LogMock extends Log {
30
+ debug: MockLogMethod;
31
+ error: MockLogMethod;
32
+ fatal: MockLogMethod;
33
+ info: MockLogMethod;
34
+ init: Mock;
35
+ lib: Mock;
36
+ mock: {
37
+ debug: MockLogMethod;
38
+ error: MockLogMethod;
39
+ fatal: MockLogMethod;
40
+ info: MockLogMethod;
41
+ init: Mock;
42
+ lib: Mock;
43
+ tag: Mock;
44
+ trace: MockLogMethod;
45
+ untag: Mock;
46
+ var: Mock;
47
+ warn: MockLogMethod;
48
+ with: Mock;
49
+ };
50
+ tag: Mock;
51
+ trace: MockLogMethod;
52
+ untag: Mock;
53
+ var: Mock;
54
+ warn: MockLogMethod;
55
+ with: Mock;
56
+ }
57
+
58
+ declare const jsonApiErrorSchema: {
59
+ readonly type: "object";
60
+ readonly properties: {
61
+ readonly errors: {
62
+ readonly type: "array";
63
+ readonly items: {
64
+ readonly type: "object";
65
+ readonly properties: {
66
+ readonly status: {
67
+ readonly type: "number";
68
+ };
69
+ readonly title: {
70
+ readonly type: "string";
71
+ };
72
+ readonly detail: {
73
+ readonly type: "string";
74
+ };
75
+ };
76
+ readonly required: readonly ["status", "title"];
77
+ };
78
+ readonly minItems: 1;
79
+ };
80
+ };
81
+ readonly required: readonly ["errors"];
82
+ };
83
+ declare const jsonApiSchema: {
84
+ readonly type: "object";
85
+ readonly properties: {
86
+ readonly data: {
87
+ readonly type: "object";
88
+ readonly properties: {
89
+ readonly id: {
90
+ readonly type: "string";
91
+ };
92
+ readonly type: {
93
+ readonly type: "string";
94
+ };
95
+ readonly attributes: {
96
+ readonly type: "object";
97
+ };
98
+ readonly links: {
99
+ readonly type: "object";
100
+ };
101
+ readonly meta: {
102
+ readonly type: "object";
103
+ };
104
+ readonly relationships: {
105
+ readonly type: "object";
106
+ };
107
+ };
108
+ readonly required: readonly ["id", "type"];
109
+ };
110
+ readonly meta: {
111
+ readonly type: "object";
112
+ };
113
+ };
114
+ readonly required: readonly ["data"];
115
+ };
116
+
117
+ declare module "vitest" {
118
+ interface Assertion<T = any> {
119
+ toBeMockFunction(): T;
120
+ }
121
+ }
122
+ declare function toBeMockFunction(this: Assertion, received: unknown): {
123
+ message: () => string;
124
+ pass: boolean;
125
+ };
126
+
127
+ declare const matchers: {
128
+ pass(message: string): any;
129
+ fail(message: string): any;
130
+ toBeEmpty(): any;
131
+ toBeOneOf<E = unknown>(members: readonly E[]): any;
132
+ toBeNil(): any;
133
+ toSatisfy<E = any>(predicate: (x: E) => boolean): any;
134
+ toBeArray(): any;
135
+ toBeArrayOfSize(x: number): any;
136
+ toBeAfter(date: Date): any;
137
+ toBeBefore(date: Date): any;
138
+ toIncludeAllMembers<E = unknown>(members: readonly E[]): any;
139
+ toIncludeAnyMembers<E = unknown>(members: readonly E[]): any;
140
+ toIncludeSameMembers<E = unknown>(members: readonly E[]): any;
141
+ toPartiallyContain<E = unknown>(member: E): any;
142
+ toSatisfyAll<E = any>(predicate: (x: E) => boolean): any;
143
+ toSatisfyAny(predicate: (x: any) => boolean): any;
144
+ toBeBoolean(): any;
145
+ toBeTrue(): any;
146
+ toBeFalse(): any;
147
+ toBeDate(): any;
148
+ toBeValidDate(): any;
149
+ toBeFunction(): any;
150
+ toBeDateString(): any;
151
+ toBeHexadecimal(): any;
152
+ toHaveBeenCalledBefore(mock: jest.MockInstance<any, any[]>, failIfNoSecondInvocation?: boolean): any;
153
+ toHaveBeenCalledAfter(mock: jest.MockInstance<any, any[]>, failIfNoFirstInvocation?: boolean): any;
154
+ toHaveBeenCalledOnce(): any;
155
+ toHaveBeenCalledExactlyOnceWith(...args: unknown[]): any;
156
+ toBeNumber(): any;
157
+ toBeNaN(): any;
158
+ toBeFinite(): any;
159
+ toBePositive(): any;
160
+ toBeNegative(): any;
161
+ toBeEven(): any;
162
+ toBeOdd(): any;
163
+ toBeWithin(start: number, end: number): any;
164
+ toBeInRange(min: number, max: number): any;
165
+ toBeObject(): any;
166
+ toContainKey(key: string): any;
167
+ toContainKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
168
+ toContainAllKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
169
+ toContainAnyKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
170
+ toContainValue<E = unknown>(value: E): any;
171
+ toContainValues<E = unknown>(values: readonly E[]): any;
172
+ toContainAllValues<E = unknown>(values: readonly E[]): any;
173
+ toContainAnyValues<E = unknown>(values: readonly E[]): any;
174
+ toContainEntry<E = unknown>(entry: readonly [keyof E, E[keyof E]]): any;
175
+ toContainEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
176
+ toContainAllEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
177
+ toContainAnyEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
178
+ toBeExtensible(): any;
179
+ toBeFrozen(): any;
180
+ toBeSealed(): any;
181
+ toResolve(): any;
182
+ toReject(): any;
183
+ toBeString(): any;
184
+ toEqualCaseInsensitive(string: string): any;
185
+ toStartWith(prefix: string): any;
186
+ toEndWith(suffix: string): any;
187
+ toInclude(substring: string): any;
188
+ toIncludeRepeated(substring: string, times: number): any;
189
+ toIncludeMultiple(substring: readonly string[]): any;
190
+ toThrowWithMessage(type: (...args: any[]) => any, message: string | RegExp): any;
191
+ toBeEmptyObject(): any;
192
+ toBeSymbol(): any;
193
+ toBeBetween(startDate: Date, endDate: Date): any;
194
+ toBeBeforeOrEqualTo(date: Date): any;
195
+ toBeAfterOrEqualTo(date: Date): any;
196
+ toEqualIgnoringWhitespace(string: string): any;
197
+ toBeCalledAboveTrace: (log: LogMock) => MatcherResult;
198
+ toBeCalledWithInitialParams: (received: vitest.Mock, ...passed: unknown[]) => MatcherResult;
199
+ toBeClass: (received: unknown) => MatcherResult;
200
+ toBeJaypieError: (received: unknown) => MatcherResult;
201
+ toBeMockFunction: typeof toBeMockFunction;
202
+ toMatchBase64: (subject: string) => MatcherResult;
203
+ toMatchJwt: (subject: string) => MatcherResult;
204
+ toMatchMongoId: (subject: string) => MatcherResult;
205
+ toMatchSignedCookie: (subject: string) => MatcherResult;
206
+ toMatchSchema: (received: unknown, schema: object) => jest_json_schema.JsonSchemaMatcherResult;
207
+ toMatchUuid: (subject: string) => MatcherResult;
208
+ toMatchUuid4: (subject: string) => MatcherResult;
209
+ toMatchUuid5: (subject: string) => MatcherResult;
210
+ toThrowBadGatewayError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
211
+ toThrowBadRequestError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
212
+ toThrowConfigurationError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
213
+ toThrowError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
214
+ toThrowForbiddenError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
215
+ toThrowGatewayTimeoutError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
216
+ toThrowInternalError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
217
+ toThrowJaypieError: (received: () => unknown | Promise<unknown>, expected?: _jaypie_core.ProjectError | (() => _jaypie_core.ProjectError) | (new () => _jaypie_core.ProjectError)) => Promise<MatcherResult>;
218
+ toThrowNotFoundError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
219
+ toThrowUnauthorizedError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
220
+ toThrowUnavailableError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
221
+ };
222
+
223
+ declare function mockLogFactory(): LogMock;
224
+ declare function spyLog(logInstance: typeof log): void;
225
+ declare function restoreLog(logInstance: typeof log): void;
226
+
227
+ interface SQSEvent {
228
+ Records: Array<{
229
+ body: string;
230
+ messageId?: string | number;
231
+ [key: string]: unknown;
232
+ }>;
233
+ }
234
+ /**
235
+ * Creates a mock SQS event with the given records
236
+ * @param records - Array of records or individual records to include in the event
237
+ * @returns SQS event object with Records array
238
+ */
239
+ declare const sqsTestRecords: (...records: Array<unknown>) => SQSEvent;
240
+
241
+ export { LOG, jsonApiErrorSchema, jsonApiSchema, matchers, mockLogFactory, restoreLog, spyLog, sqsTestRecords };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as jestExtendedMatchers from 'jest-extended';
2
2
  import { matchers as matchers$1 } from 'jest-json-schema';
3
3
  import { isDeepStrictEqual } from 'node:util';
4
- import { isJaypieError, UnauthorizedError, NotFoundError, InternalError, GatewayTimeoutError, ForbiddenError, ConfigurationError, BadRequestError, BadGatewayError, UnavailableError } from '@jaypie/core';
5
4
  import { vi } from 'vitest';
5
+ import { isJaypieError, UnauthorizedError, NotFoundError, InternalError, GatewayTimeoutError, ForbiddenError, ConfigurationError, BadRequestError, BadGatewayError, UnavailableError } from '@jaypie/core';
6
6
 
7
7
  const LOG = {
8
8
  LEVEL: {
@@ -79,7 +79,6 @@ const calledAboveTrace = (log) => {
79
79
  pass: true,
80
80
  };
81
81
  }
82
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
83
82
  }
84
83
  catch (error) {
85
84
  throw Error(`[calledAboveTrace] log is not a mock object`);
@@ -136,10 +135,8 @@ const toBeClass = (received) => {
136
135
  let pass = false;
137
136
  if (typeof received === "function") {
138
137
  try {
139
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
140
138
  new received();
141
139
  pass = true;
142
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
143
140
  }
144
141
  catch (error) {
145
142
  pass = false;
@@ -197,6 +194,15 @@ const toBeJaypieError = (received) => {
197
194
  }
198
195
  };
199
196
 
197
+ function toBeMockFunction(received) {
198
+ const { equals, utils } = this;
199
+ const pass = typeof received === "function" && vi.isMockFunction(received);
200
+ return {
201
+ message: () => `expected ${utils.printReceived(received)} ${pass ? "not " : ""}to be a mock function`,
202
+ pass,
203
+ };
204
+ }
205
+
200
206
  function forSubjectToMatchPattern(subject, pattern, { patternName = "pattern" } = {}) {
201
207
  if (pattern.test(subject)) {
202
208
  return {
@@ -295,13 +301,16 @@ const toThrowJaypieError = async (received, expected) => {
295
301
  }
296
302
  catch (error) {
297
303
  if (isJaypieError(error)) {
304
+ // Cast to the specific type with _type property
305
+ const jaypieError = error;
298
306
  // If expected is also a JaypieError, check if the error matches
299
307
  if (expectedError && isJaypieError(expectedError)) {
308
+ const expectedJaypieError = expectedError;
300
309
  // If the error does not match, fail the test
301
- if (error._type !== expectedError._type) {
310
+ if (jaypieError._type !== expectedJaypieError._type) {
302
311
  return {
303
312
  pass: false,
304
- message: () => `Expected function to throw "${expectedError._type}", but it threw "${error._type}"`,
313
+ message: () => `Expected function to throw "${expectedJaypieError._type}", but it threw "${jaypieError._type}"`,
305
314
  };
306
315
  }
307
316
  }
@@ -337,6 +346,7 @@ const matchers = {
337
346
  toBeCalledWithInitialParams,
338
347
  toBeClass,
339
348
  toBeJaypieError,
349
+ toBeMockFunction,
340
350
  toMatchBase64,
341
351
  toMatchJwt,
342
352
  toMatchMongoId,
@@ -418,27 +428,35 @@ const LOG_METHOD_NAMES = [
418
428
  "warn",
419
429
  "with",
420
430
  ];
431
+ // Use Record type for more flexible access pattern
421
432
  const originalLogMethods = new WeakMap();
422
- function spyLog(log) {
423
- if (!originalLogMethods.has(log)) {
433
+ function spyLog(logInstance) {
434
+ if (!originalLogMethods.has(logInstance)) {
424
435
  const mockLog = mockLogFactory();
425
436
  const originalMethods = {};
437
+ // Save only methods that actually exist on the log instance
426
438
  LOG_METHOD_NAMES.forEach((method) => {
427
- originalMethods[method] = log[method];
428
- log[method] = mockLog[method];
439
+ if (method in logInstance) {
440
+ originalMethods[method] =
441
+ logInstance[method];
442
+ // Use type assertion after checking existence
443
+ logInstance[method] = mockLog[method];
444
+ }
429
445
  });
430
- originalLogMethods.set(log, originalMethods);
446
+ originalLogMethods.set(logInstance, originalMethods);
431
447
  }
432
448
  }
433
- function restoreLog(log) {
434
- const originalMethods = originalLogMethods.get(log);
449
+ function restoreLog(logInstance) {
450
+ const originalMethods = originalLogMethods.get(logInstance);
435
451
  if (originalMethods) {
436
452
  LOG_METHOD_NAMES.forEach((method) => {
437
- if (originalMethods[method]) {
438
- log[method] = originalMethods[method];
453
+ if (method in originalMethods && method in logInstance) {
454
+ // Use type assertion after checking existence
455
+ logInstance[method] =
456
+ originalMethods[method];
439
457
  }
440
458
  });
441
- originalLogMethods.delete(log);
459
+ originalLogMethods.delete(logInstance);
442
460
  }
443
461
  }
444
462
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/constants.ts","../src/jsonApiSchema.module.ts","../src/matchers/toBeCalledAboveTrace.matcher.ts","../src/matchers/toBeCalledWithInitialParams.matcher.ts","../src/matchers/toBeClass.matcher.ts","../src/matchers/toBeJaypieError.matcher.ts","../src/matchers/toMatch.matcher.ts","../src/matchers/toThrowError.matcher.ts","../src/matchers/toThrowJaypieError.matcher.ts","../src/matchers.module.ts","../src/mockLog.module.ts","../src/sqsTestRecords.function.ts"],"sourcesContent":["export const LOG = {\n LEVEL: {\n ALL: \"all\",\n DEBUG: \"debug\",\n ERROR: \"error\",\n FATAL: \"fatal\",\n INFO: \"info\",\n SILENT: \"silent\",\n TRACE: \"trace\",\n WARN: \"warn\",\n },\n} as const;\n\nexport const RE_BASE64_PATTERN = /^[a-zA-Z0-9\\\\+\\\\/]+$/;\nexport const RE_JWT_PATTERN = /^([^.]+)\\.([^.]+)\\.([^.]+)$/;\nexport const RE_MONGO_ID_PATTERN = /^[a-f0-9]{24}$/i;\nexport const RE_SIGNED_COOKIE_PATTERN = /^s:([^.]+)\\.([^.]+)$/;\nexport const RE_UUID_4_PATTERN =\n /^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;\nexport const RE_UUID_5_PATTERN =\n /^[a-f0-9]{8}-?[a-f0-9]{4}-?5[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;\nexport const RE_UUID_PATTERN =\n /^[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;\n","import { JsonApiData, JsonApiError } from \"./types/jaypie-testkit\";\n\nexport const jsonApiErrorSchema = {\n type: \"object\",\n properties: {\n errors: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n status: { type: \"number\" },\n title: { type: \"string\" },\n detail: { type: \"string\" },\n },\n required: [\"status\", \"title\"],\n },\n minItems: 1,\n },\n },\n required: [\"errors\"],\n} as const;\n\nexport const jsonApiSchema = {\n type: \"object\",\n properties: {\n data: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n type: { type: \"string\" },\n attributes: { type: \"object\" },\n links: { type: \"object\" },\n meta: { type: \"object\" },\n relationships: { type: \"object\" },\n },\n required: [\"id\", \"type\"],\n },\n meta: { type: \"object\" },\n },\n required: [\"data\"],\n} as const;\n\n// Type guards\nexport const isJsonApiError = (obj: unknown): obj is JsonApiError => {\n if (!obj || typeof obj !== \"object\") return false;\n return \"errors\" in obj && Array.isArray((obj as JsonApiError).errors);\n};\n\nexport const isJsonApiData = (obj: unknown): obj is JsonApiData => {\n if (!obj || typeof obj !== \"object\") return false;\n return \"data\" in obj && typeof (obj as JsonApiData).data === \"object\";\n};\n","import { LogMock, MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\nconst calledAboveTrace = (log: LogMock): MatcherResult => {\n try {\n if (\n log.debug.mock.calls.length > 0 ||\n log.info.mock.calls.length > 0 ||\n log.warn.mock.calls.length > 0 ||\n log.error.mock.calls.length > 0 ||\n log.fatal.mock.calls.length > 0\n ) {\n return {\n message: () => `expected log not to have been called above trace`,\n pass: true,\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n throw Error(`[calledAboveTrace] log is not a mock object`);\n }\n\n return {\n message: () => `expected log not to have been called above trace`,\n pass: false,\n };\n};\n\n//\n//\n// Export\n//\n\nexport default calledAboveTrace;\n","import { isDeepStrictEqual as isEqual } from \"node:util\";\nimport { Mock } from \"vitest\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\nconst toBeCalledWithInitialParams = (\n received: Mock,\n ...passed: unknown[]\n): MatcherResult => {\n let pass: boolean | undefined;\n\n if (!received || typeof received !== \"function\" || !received.mock) {\n return {\n message: () =>\n `Expectation \\`toBeCalledWithInitialParams\\` expected a mock function`,\n pass: false,\n };\n }\n\n received.mock.calls.forEach((call: unknown[]) => {\n if (call.length >= passed.length) {\n let matching = true;\n for (let i = 0; i < passed.length && matching; i += 1) {\n if (!isEqual(passed[i], call[i])) matching = false;\n }\n pass = pass || matching;\n }\n });\n\n if (pass === undefined) pass = false;\n\n if (pass) {\n return {\n message: () =>\n `Expectation \\`toBeCalledWithInitialParams\\` expected call beginning with [${passed},...]`,\n pass: true,\n };\n } else {\n return {\n message: () =>\n `Expectation \\`not.toBeCalledWithInitialParams\\` did not expect call beginning with [${passed},...]`,\n pass: false,\n };\n }\n};\n\n//\n//\n// Export\n//\n\nexport default toBeCalledWithInitialParams;\n","import { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\nconst toBeClass = (received: unknown): MatcherResult => {\n let pass = false;\n if (typeof received === \"function\") {\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (received as any)();\n pass = true;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n pass = false;\n }\n }\n if (pass) {\n return {\n message: () => `expected ${received} not to be a class`,\n pass: true,\n };\n }\n return {\n message: () => `expected ${received} to be a class`,\n pass: false,\n };\n};\n\n//\n//\n// Export\n//\n\nexport default toBeClass;\n","import { matchers as jsonSchemaMatchers } from \"jest-json-schema\";\nimport { jsonApiErrorSchema } from \"../jsonApiSchema.module\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Helper Functions\n//\n\nfunction isErrorObjectJaypieError(error: Error): MatcherResult {\n if (\"isProjectError\" in error) {\n return {\n message: () => `expected \"${error}\" not to be a Jaypie error`,\n pass: true,\n };\n }\n return {\n message: () => `expected \"${error}\" to be a Jaypie error`,\n pass: false,\n };\n}\n\n//\n//\n// Main\n//\n\nconst toBeJaypieError = (received: unknown): MatcherResult => {\n // See if it is an instance of error:\n if (received instanceof Error) {\n return isErrorObjectJaypieError(received);\n }\n\n const result = jsonSchemaMatchers.toMatchSchema(received, jsonApiErrorSchema);\n if (result.pass) {\n return {\n message: () => `expected ${received} not to be a Jaypie error`,\n pass: true,\n };\n } else {\n return {\n message: () => `expected ${received} to be a Jaypie error`,\n pass: false,\n };\n }\n};\n\n//\n//\n// Export\n//\n\nexport default toBeJaypieError;\n","import {\n RE_BASE64_PATTERN,\n RE_JWT_PATTERN,\n RE_MONGO_ID_PATTERN,\n RE_SIGNED_COOKIE_PATTERN,\n RE_UUID_4_PATTERN,\n RE_UUID_5_PATTERN,\n RE_UUID_PATTERN,\n} from \"../constants.js\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Helper\n//\n\ninterface ForSubjectToMatchPatternOptions {\n patternName?: string;\n}\n\nfunction forSubjectToMatchPattern(\n subject: string,\n pattern: RegExp,\n { patternName = \"pattern\" }: ForSubjectToMatchPatternOptions = {},\n): MatcherResult {\n if (pattern.test(subject)) {\n return {\n message: () => `expected \"${subject}\" not to match ${patternName}`,\n pass: true,\n };\n }\n return {\n message: () => `expected \"${subject}\" to match ${patternName}`,\n pass: false,\n };\n}\n\n//\n//\n// Main\n//\n\nexport const toMatchBase64 = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_BASE64_PATTERN, {\n patternName: \"Base64\",\n });\n\nexport const toMatchJwt = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_JWT_PATTERN, {\n patternName: \"JWT\",\n });\n\nexport const toMatchMongoId = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_MONGO_ID_PATTERN, {\n patternName: \"MongoDbId\",\n });\n\nexport const toMatchSignedCookie = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_SIGNED_COOKIE_PATTERN, {\n patternName: \"Signed-Cookie\",\n });\n\nexport const toMatchUuid4 = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_UUID_4_PATTERN, {\n patternName: \"UUIDv4\",\n });\n\nexport const toMatchUuid5 = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_UUID_5_PATTERN, {\n patternName: \"UUIDv5\",\n });\n\n/**\n * Determines if subject matches a UUID pattern.\n * Does _NOT_ check if the UUID is valid.\n */\nexport const toMatchUuid = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_UUID_PATTERN, {\n patternName: \"UUID\",\n });\n","import { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\ntype ReceivedFunction = () => unknown | Promise<unknown>;\n\nconst toThrowError = async (\n received: ReceivedFunction,\n): Promise<MatcherResult> => {\n const isAsync =\n received.constructor.name === \"AsyncFunction\" ||\n received.constructor.name === \"Promise\";\n\n try {\n const result = received();\n\n if (isAsync) {\n await result;\n }\n\n return {\n pass: false,\n message: () =>\n \"Expected function to throw an error, but it did not throw.\",\n };\n } catch (error) {\n return {\n pass: true,\n message: () =>\n `Expected function not to throw an error, but it threw ${error}`,\n };\n }\n};\n\n//\n//\n// Export\n//\n\nexport default toThrowError;\n","import {\n BadGatewayError,\n BadRequestError,\n ConfigurationError,\n ForbiddenError,\n GatewayTimeoutError,\n InternalError,\n isJaypieError,\n NotFoundError,\n ProjectError,\n UnauthorizedError,\n UnavailableError,\n} from \"@jaypie/core\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\ntype ReceivedFunction = () => unknown | Promise<unknown>;\ntype ErrorConstructor = new () => ProjectError;\n\nfunction isErrorConstructor(value: unknown): value is ErrorConstructor {\n return typeof value === \"function\" && \"prototype\" in value;\n}\n\nconst toThrowJaypieError = async (\n received: ReceivedFunction,\n expected?: ProjectError | (() => ProjectError) | ErrorConstructor,\n): Promise<MatcherResult> => {\n const isAsync =\n received.constructor.name === \"AsyncFunction\" ||\n received.constructor.name === \"Promise\";\n\n let expectedError: ProjectError | undefined = undefined;\n\n // Handle constructor, function, or instance\n if (typeof expected === \"function\") {\n if (isErrorConstructor(expected)) {\n // It's a constructor\n expectedError = new expected();\n } else {\n // It's a regular function\n expectedError = expected();\n }\n } else if (expected) {\n // It's an instance\n expectedError = expected;\n }\n\n try {\n const result = received();\n\n if (isAsync) {\n await result;\n }\n\n // If no error is thrown, fail the test\n return {\n pass: false,\n message: () =>\n \"Expected function to throw a JaypieError, but it did not throw.\",\n };\n } catch (error) {\n if (isJaypieError(error)) {\n // If expected is also a JaypieError, check if the error matches\n if (expectedError && isJaypieError(expectedError)) {\n // If the error does not match, fail the test\n if (error._type !== expectedError._type) {\n return {\n pass: false,\n message: () =>\n `Expected function to throw \"${expectedError._type}\", but it threw \"${error._type}\"`,\n };\n }\n }\n return {\n pass: true,\n message: () =>\n `Expected function not to throw a JaypieError, but it threw ${error}`,\n };\n }\n\n return {\n pass: false,\n message: () =>\n `Expected function to throw a JaypieError, but it threw ${error}`,\n };\n }\n};\n\n//\n//\n// Convenience Methods\n//\n\nconst toThrowBadGatewayError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, BadGatewayError);\nconst toThrowBadRequestError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, BadRequestError);\nconst toThrowConfigurationError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, ConfigurationError);\nconst toThrowForbiddenError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, ForbiddenError);\nconst toThrowGatewayTimeoutError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, GatewayTimeoutError);\nconst toThrowInternalError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, InternalError);\nconst toThrowNotFoundError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, NotFoundError);\nconst toThrowUnauthorizedError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, UnauthorizedError);\nconst toThrowUnavailableError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, UnavailableError);\n\n//\n//\n// Export\n//\n\nexport default toThrowJaypieError;\n\nexport {\n toThrowBadGatewayError,\n toThrowBadRequestError,\n toThrowConfigurationError,\n toThrowForbiddenError,\n toThrowGatewayTimeoutError,\n toThrowInternalError,\n toThrowNotFoundError,\n toThrowUnauthorizedError,\n toThrowUnavailableError,\n};\n","import * as jestExtendedMatchers from \"jest-extended\";\nimport { matchers as jestJsonSchemaMatchers } from \"jest-json-schema\";\nimport toBeCalledAboveTrace from \"./matchers/toBeCalledAboveTrace.matcher.js\";\nimport toBeCalledWithInitialParams from \"./matchers/toBeCalledWithInitialParams.matcher.js\";\nimport toBeClass from \"./matchers/toBeClass.matcher.js\";\nimport toBeJaypieError from \"./matchers/toBeJaypieError.matcher.js\";\nimport {\n toMatchBase64,\n toMatchJwt,\n toMatchMongoId,\n toMatchSignedCookie,\n toMatchUuid,\n toMatchUuid4,\n toMatchUuid5,\n} from \"./matchers/toMatch.matcher.js\";\nimport toThrowError from \"./matchers/toThrowError.matcher.js\";\nimport toThrowJaypieError, {\n toThrowBadGatewayError,\n toThrowBadRequestError,\n toThrowConfigurationError,\n toThrowForbiddenError,\n toThrowGatewayTimeoutError,\n toThrowInternalError,\n toThrowNotFoundError,\n toThrowUnauthorizedError,\n toThrowUnavailableError,\n} from \"./matchers/toThrowJaypieError.matcher.js\";\n\n// Combine all matchers\nconst matchers = {\n // Custom Jaypie matchers\n toBeCalledAboveTrace,\n toBeCalledWithInitialParams,\n toBeClass,\n toBeJaypieError,\n toMatchBase64,\n toMatchJwt,\n toMatchMongoId,\n toMatchSignedCookie,\n toMatchSchema: jestJsonSchemaMatchers.toMatchSchema,\n toMatchUuid,\n toMatchUuid4,\n toMatchUuid5,\n toThrowBadGatewayError,\n toThrowBadRequestError,\n toThrowConfigurationError,\n toThrowError,\n toThrowForbiddenError,\n toThrowGatewayTimeoutError,\n toThrowInternalError,\n toThrowJaypieError,\n toThrowNotFoundError,\n toThrowUnauthorizedError,\n toThrowUnavailableError,\n\n // Include all jest-extended matchers\n ...jestExtendedMatchers,\n};\n\nexport default matchers;\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Log } from \"@jaypie/core\";\nimport { vi } from \"vitest\";\nimport { LogMock } from \"./types/jaypie-testkit\";\n\nexport function mockLogFactory(): LogMock {\n // Create skeleton of mock objects\n const mock = {\n debug: vi.fn(),\n error: vi.fn(),\n fatal: vi.fn(),\n info: vi.fn(),\n init: vi.fn(),\n lib: vi.fn(),\n tag: vi.fn(),\n trace: vi.fn(),\n untag: vi.fn(),\n var: vi.fn(),\n warn: vi.fn(),\n with: vi.fn(),\n } as LogMock;\n\n // Fill out nested mocks\n mock.debug.var = mock.var;\n mock.error.var = mock.var;\n mock.fatal.var = mock.var;\n mock.info.var = mock.var;\n mock.trace.var = mock.var;\n mock.warn.var = mock.var;\n\n // Have modules return correct objects\n mock.init.mockReturnValue(null);\n mock.lib.mockReturnValue(mock);\n mock.with.mockReturnValue(mock);\n\n // Pin mocks to the module\n mock.mock = {\n debug: mock.debug,\n error: mock.error,\n fatal: mock.fatal,\n info: mock.info,\n init: mock.init,\n lib: mock.lib,\n tag: mock.tag,\n trace: mock.trace,\n untag: mock.untag,\n var: mock.var,\n warn: mock.warn,\n with: mock.with,\n };\n\n return mock;\n}\n\nconst LOG_METHOD_NAMES = [\n \"debug\",\n \"error\",\n \"fatal\",\n \"info\",\n \"init\",\n \"lib\",\n \"tag\",\n \"trace\",\n \"untag\",\n \"var\",\n \"warn\",\n \"with\",\n] as const;\n\nconst originalLogMethods = new WeakMap<Log, Partial<Log>>();\n\nexport function spyLog(log: Log): void {\n if (!originalLogMethods.has(log)) {\n const mockLog = mockLogFactory();\n const originalMethods: Partial<Log> = {};\n\n LOG_METHOD_NAMES.forEach((method) => {\n originalMethods[method] = log[method] as any;\n log[method] = mockLog[method] as any;\n });\n\n originalLogMethods.set(log, originalMethods);\n }\n}\n\nexport function restoreLog(log: Log): void {\n const originalMethods = originalLogMethods.get(log);\n if (originalMethods) {\n LOG_METHOD_NAMES.forEach((method) => {\n if (originalMethods[method]) {\n log[method] = originalMethods[method] as any;\n }\n });\n originalLogMethods.delete(log);\n }\n}\n","interface SQSEvent {\n Records: Array<{\n body: string;\n messageId?: string | number;\n [key: string]: unknown;\n }>;\n}\n\n/**\n * Creates a mock SQS event with the given records\n * @param records - Array of records or individual records to include in the event\n * @returns SQS event object with Records array\n */\nconst sqsTestRecords = (...records: Array<unknown>): SQSEvent => {\n // If first argument is an array, use that as records\n const recordsArray = Array.isArray(records[0]) ? records[0] : records;\n\n // Map records to SQS record format\n const formattedRecords = recordsArray.map((record) => {\n if (typeof record === \"object\" && record !== null) {\n return {\n ...record,\n body:\n typeof (record as { body?: unknown }).body === \"string\"\n ? (record as { body: string }).body\n : JSON.stringify((record as { body?: unknown }).body ?? record),\n };\n }\n return {\n body: String(record),\n };\n });\n\n return {\n Records: formattedRecords,\n };\n};\n\nexport default sqsTestRecords;\n"],"names":["isEqual","jsonSchemaMatchers","toBeCalledAboveTrace","jestJsonSchemaMatchers"],"mappings":";;;;;;AAAa,MAAA,GAAG,GAAG;AACjB,IAAA,KAAK,EAAE;AACL,QAAA,GAAG,EAAE,KAAK;AACV,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,IAAI,EAAE,MAAM;AACZ,QAAA,MAAM,EAAE,QAAQ;AAChB,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,IAAI,EAAE,MAAM;AACb,KAAA;;AAGI,MAAM,iBAAiB,GAAG,sBAAsB;AAChD,MAAM,cAAc,GAAG,6BAA6B;AACpD,MAAM,mBAAmB,GAAG,iBAAiB;AAC7C,MAAM,wBAAwB,GAAG,sBAAsB;AACvD,MAAM,iBAAiB,GAC5B,4EAA4E;AACvE,MAAM,iBAAiB,GAC5B,4EAA4E;AACvE,MAAM,eAAe,GAC1B,2EAA2E;;ACpBhE,MAAA,kBAAkB,GAAG;AAChC,IAA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KAC1B;AACH;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/constants.ts","../src/jsonApiSchema.module.ts","../src/matchers/toBeCalledAboveTrace.matcher.ts","../src/matchers/toBeCalledWithInitialParams.matcher.ts","../src/matchers/toBeClass.matcher.ts","../src/matchers/toBeJaypieError.matcher.ts","../src/matchers/toBeMockFunction.matcher.ts","../src/matchers/toMatch.matcher.ts","../src/matchers/toThrowError.matcher.ts","../src/matchers/toThrowJaypieError.matcher.ts","../src/matchers.module.ts","../src/mockLog.module.ts","../src/sqsTestRecords.function.ts"],"sourcesContent":["export const LOG = {\n LEVEL: {\n ALL: \"all\",\n DEBUG: \"debug\",\n ERROR: \"error\",\n FATAL: \"fatal\",\n INFO: \"info\",\n SILENT: \"silent\",\n TRACE: \"trace\",\n WARN: \"warn\",\n },\n} as const;\n\nexport const RE_BASE64_PATTERN = /^[a-zA-Z0-9\\\\+\\\\/]+$/;\nexport const RE_JWT_PATTERN = /^([^.]+)\\.([^.]+)\\.([^.]+)$/;\nexport const RE_MONGO_ID_PATTERN = /^[a-f0-9]{24}$/i;\nexport const RE_SIGNED_COOKIE_PATTERN = /^s:([^.]+)\\.([^.]+)$/;\nexport const RE_UUID_4_PATTERN =\n /^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;\nexport const RE_UUID_5_PATTERN =\n /^[a-f0-9]{8}-?[a-f0-9]{4}-?5[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;\nexport const RE_UUID_PATTERN =\n /^[a-f0-9]{8}-?[a-f0-9]{4}-?[a-f0-9]{4}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/i;\n","import { JsonApiData, JsonApiError } from \"./types/jaypie-testkit\";\n\nexport const jsonApiErrorSchema = {\n type: \"object\",\n properties: {\n errors: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n status: { type: \"number\" },\n title: { type: \"string\" },\n detail: { type: \"string\" },\n },\n required: [\"status\", \"title\"],\n },\n minItems: 1,\n },\n },\n required: [\"errors\"],\n} as const;\n\nexport const jsonApiSchema = {\n type: \"object\",\n properties: {\n data: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n type: { type: \"string\" },\n attributes: { type: \"object\" },\n links: { type: \"object\" },\n meta: { type: \"object\" },\n relationships: { type: \"object\" },\n },\n required: [\"id\", \"type\"],\n },\n meta: { type: \"object\" },\n },\n required: [\"data\"],\n} as const;\n\n// Type guards\nexport const isJsonApiError = (obj: unknown): obj is JsonApiError => {\n if (!obj || typeof obj !== \"object\") return false;\n return \"errors\" in obj && Array.isArray((obj as JsonApiError).errors);\n};\n\nexport const isJsonApiData = (obj: unknown): obj is JsonApiData => {\n if (!obj || typeof obj !== \"object\") return false;\n return \"data\" in obj && typeof (obj as JsonApiData).data === \"object\";\n};\n","import { LogMock, MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\nconst calledAboveTrace = (log: LogMock): MatcherResult => {\n try {\n if (\n log.debug.mock.calls.length > 0 ||\n log.info.mock.calls.length > 0 ||\n log.warn.mock.calls.length > 0 ||\n log.error.mock.calls.length > 0 ||\n log.fatal.mock.calls.length > 0\n ) {\n return {\n message: () => `expected log not to have been called above trace`,\n pass: true,\n };\n }\n } catch (error) {\n throw Error(`[calledAboveTrace] log is not a mock object`);\n }\n\n return {\n message: () => `expected log not to have been called above trace`,\n pass: false,\n };\n};\n\n//\n//\n// Export\n//\n\nexport default calledAboveTrace;\n","import { isDeepStrictEqual as isEqual } from \"node:util\";\nimport { Mock } from \"vitest\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\nconst toBeCalledWithInitialParams = (\n received: Mock,\n ...passed: unknown[]\n): MatcherResult => {\n let pass: boolean | undefined;\n\n if (!received || typeof received !== \"function\" || !received.mock) {\n return {\n message: () =>\n `Expectation \\`toBeCalledWithInitialParams\\` expected a mock function`,\n pass: false,\n };\n }\n\n received.mock.calls.forEach((call: unknown[]) => {\n if (call.length >= passed.length) {\n let matching = true;\n for (let i = 0; i < passed.length && matching; i += 1) {\n if (!isEqual(passed[i], call[i])) matching = false;\n }\n pass = pass || matching;\n }\n });\n\n if (pass === undefined) pass = false;\n\n if (pass) {\n return {\n message: () =>\n `Expectation \\`toBeCalledWithInitialParams\\` expected call beginning with [${passed},...]`,\n pass: true,\n };\n } else {\n return {\n message: () =>\n `Expectation \\`not.toBeCalledWithInitialParams\\` did not expect call beginning with [${passed},...]`,\n pass: false,\n };\n }\n};\n\n//\n//\n// Export\n//\n\nexport default toBeCalledWithInitialParams;\n","import { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\nconst toBeClass = (received: unknown): MatcherResult => {\n let pass = false;\n if (typeof received === \"function\") {\n try {\n new (received as any)();\n pass = true;\n } catch (error) {\n pass = false;\n }\n }\n if (pass) {\n return {\n message: () => `expected ${received} not to be a class`,\n pass: true,\n };\n }\n return {\n message: () => `expected ${received} to be a class`,\n pass: false,\n };\n};\n\n//\n//\n// Export\n//\n\nexport default toBeClass;\n","import { matchers as jsonSchemaMatchers } from \"jest-json-schema\";\nimport { jsonApiErrorSchema } from \"../jsonApiSchema.module\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Helper Functions\n//\n\nfunction isErrorObjectJaypieError(error: Error): MatcherResult {\n if (\"isProjectError\" in error) {\n return {\n message: () => `expected \"${error}\" not to be a Jaypie error`,\n pass: true,\n };\n }\n return {\n message: () => `expected \"${error}\" to be a Jaypie error`,\n pass: false,\n };\n}\n\n//\n//\n// Main\n//\n\nconst toBeJaypieError = (received: unknown): MatcherResult => {\n // See if it is an instance of error:\n if (received instanceof Error) {\n return isErrorObjectJaypieError(received);\n }\n\n const result = jsonSchemaMatchers.toMatchSchema(received, jsonApiErrorSchema);\n if (result.pass) {\n return {\n message: () => `expected ${received} not to be a Jaypie error`,\n pass: true,\n };\n } else {\n return {\n message: () => `expected ${received} to be a Jaypie error`,\n pass: false,\n };\n }\n};\n\n//\n//\n// Export\n//\n\nexport default toBeJaypieError;\n","import { vi } from \"vitest\";\nimport type { Assertion } from \"vitest\";\n\ndeclare module \"vitest\" {\n interface Assertion<T = any> {\n toBeMockFunction(): T;\n }\n}\n\nexport function toBeMockFunction(this: Assertion, received: unknown) {\n const { equals, utils } = this;\n const pass = typeof received === \"function\" && vi.isMockFunction(received);\n\n return {\n message: () =>\n `expected ${utils.printReceived(received)} ${\n pass ? \"not \" : \"\"\n }to be a mock function`,\n pass,\n };\n}\n","import {\n RE_BASE64_PATTERN,\n RE_JWT_PATTERN,\n RE_MONGO_ID_PATTERN,\n RE_SIGNED_COOKIE_PATTERN,\n RE_UUID_4_PATTERN,\n RE_UUID_5_PATTERN,\n RE_UUID_PATTERN,\n} from \"../constants.js\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Helper\n//\n\ninterface ForSubjectToMatchPatternOptions {\n patternName?: string;\n}\n\nfunction forSubjectToMatchPattern(\n subject: string,\n pattern: RegExp,\n { patternName = \"pattern\" }: ForSubjectToMatchPatternOptions = {},\n): MatcherResult {\n if (pattern.test(subject)) {\n return {\n message: () => `expected \"${subject}\" not to match ${patternName}`,\n pass: true,\n };\n }\n return {\n message: () => `expected \"${subject}\" to match ${patternName}`,\n pass: false,\n };\n}\n\n//\n//\n// Main\n//\n\nexport const toMatchBase64 = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_BASE64_PATTERN, {\n patternName: \"Base64\",\n });\n\nexport const toMatchJwt = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_JWT_PATTERN, {\n patternName: \"JWT\",\n });\n\nexport const toMatchMongoId = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_MONGO_ID_PATTERN, {\n patternName: \"MongoDbId\",\n });\n\nexport const toMatchSignedCookie = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_SIGNED_COOKIE_PATTERN, {\n patternName: \"Signed-Cookie\",\n });\n\nexport const toMatchUuid4 = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_UUID_4_PATTERN, {\n patternName: \"UUIDv4\",\n });\n\nexport const toMatchUuid5 = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_UUID_5_PATTERN, {\n patternName: \"UUIDv5\",\n });\n\n/**\n * Determines if subject matches a UUID pattern.\n * Does _NOT_ check if the UUID is valid.\n */\nexport const toMatchUuid = (subject: string): MatcherResult =>\n forSubjectToMatchPattern(subject, RE_UUID_PATTERN, {\n patternName: \"UUID\",\n });\n","import { MatcherResult } from \"../types/jaypie-testkit\";\n\n//\n//\n// Main\n//\n\ntype ReceivedFunction = () => unknown | Promise<unknown>;\n\nconst toThrowError = async (\n received: ReceivedFunction,\n): Promise<MatcherResult> => {\n const isAsync =\n received.constructor.name === \"AsyncFunction\" ||\n received.constructor.name === \"Promise\";\n\n try {\n const result = received();\n\n if (isAsync) {\n await result;\n }\n\n return {\n pass: false,\n message: () =>\n \"Expected function to throw an error, but it did not throw.\",\n };\n } catch (error) {\n return {\n pass: true,\n message: () =>\n `Expected function not to throw an error, but it threw ${error}`,\n };\n }\n};\n\n//\n//\n// Export\n//\n\nexport default toThrowError;\n","import {\n BadGatewayError,\n BadRequestError,\n ConfigurationError,\n ForbiddenError,\n GatewayTimeoutError,\n InternalError,\n isJaypieError,\n NotFoundError,\n ProjectError,\n UnauthorizedError,\n UnavailableError,\n} from \"@jaypie/core\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n// Define a more specific type for ProjectError with _type field\ntype JaypieErrorWithType = ProjectError & { _type: string };\n\n//\n//\n// Main\n//\n\ntype ReceivedFunction = () => unknown | Promise<unknown>;\ntype ErrorConstructor = new () => ProjectError;\n\nfunction isErrorConstructor(value: unknown): value is ErrorConstructor {\n return typeof value === \"function\" && \"prototype\" in value;\n}\n\nconst toThrowJaypieError = async (\n received: ReceivedFunction,\n expected?: ProjectError | (() => ProjectError) | ErrorConstructor,\n): Promise<MatcherResult> => {\n const isAsync =\n received.constructor.name === \"AsyncFunction\" ||\n received.constructor.name === \"Promise\";\n\n let expectedError: ProjectError | undefined = undefined;\n\n // Handle constructor, function, or instance\n if (typeof expected === \"function\") {\n if (isErrorConstructor(expected)) {\n // It's a constructor\n expectedError = new expected();\n } else {\n // It's a regular function\n expectedError = expected();\n }\n } else if (expected) {\n // It's an instance\n expectedError = expected;\n }\n\n try {\n const result = received();\n\n if (isAsync) {\n await result;\n }\n\n // If no error is thrown, fail the test\n return {\n pass: false,\n message: () =>\n \"Expected function to throw a JaypieError, but it did not throw.\",\n };\n } catch (error) {\n if (isJaypieError(error)) {\n // Cast to the specific type with _type property\n const jaypieError = error as JaypieErrorWithType;\n\n // If expected is also a JaypieError, check if the error matches\n if (expectedError && isJaypieError(expectedError)) {\n const expectedJaypieError = expectedError as JaypieErrorWithType;\n // If the error does not match, fail the test\n if (jaypieError._type !== expectedJaypieError._type) {\n return {\n pass: false,\n message: () =>\n `Expected function to throw \"${expectedJaypieError._type}\", but it threw \"${jaypieError._type}\"`,\n };\n }\n }\n return {\n pass: true,\n message: () =>\n `Expected function not to throw a JaypieError, but it threw ${error}`,\n };\n }\n\n return {\n pass: false,\n message: () =>\n `Expected function to throw a JaypieError, but it threw ${error}`,\n };\n }\n};\n\n//\n//\n// Convenience Methods\n//\n\nconst toThrowBadGatewayError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, BadGatewayError);\nconst toThrowBadRequestError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, BadRequestError);\nconst toThrowConfigurationError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, ConfigurationError);\nconst toThrowForbiddenError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, ForbiddenError);\nconst toThrowGatewayTimeoutError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, GatewayTimeoutError);\nconst toThrowInternalError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, InternalError);\nconst toThrowNotFoundError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, NotFoundError);\nconst toThrowUnauthorizedError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, UnauthorizedError);\nconst toThrowUnavailableError = (received: ReceivedFunction) =>\n toThrowJaypieError(received, UnavailableError);\n\n//\n//\n// Export\n//\n\nexport default toThrowJaypieError;\n\nexport {\n toThrowBadGatewayError,\n toThrowBadRequestError,\n toThrowConfigurationError,\n toThrowForbiddenError,\n toThrowGatewayTimeoutError,\n toThrowInternalError,\n toThrowNotFoundError,\n toThrowUnauthorizedError,\n toThrowUnavailableError,\n};\n","import * as jestExtendedMatchers from \"jest-extended\";\nimport { matchers as jestJsonSchemaMatchers } from \"jest-json-schema\";\nimport toBeCalledAboveTrace from \"./matchers/toBeCalledAboveTrace.matcher.js\";\nimport toBeCalledWithInitialParams from \"./matchers/toBeCalledWithInitialParams.matcher.js\";\nimport toBeClass from \"./matchers/toBeClass.matcher.js\";\nimport toBeJaypieError from \"./matchers/toBeJaypieError.matcher.js\";\nimport { toBeMockFunction } from \"./matchers/toBeMockFunction.matcher.js\";\nimport {\n toMatchBase64,\n toMatchJwt,\n toMatchMongoId,\n toMatchSignedCookie,\n toMatchUuid,\n toMatchUuid4,\n toMatchUuid5,\n} from \"./matchers/toMatch.matcher.js\";\nimport toThrowError from \"./matchers/toThrowError.matcher.js\";\nimport toThrowJaypieError, {\n toThrowBadGatewayError,\n toThrowBadRequestError,\n toThrowConfigurationError,\n toThrowForbiddenError,\n toThrowGatewayTimeoutError,\n toThrowInternalError,\n toThrowNotFoundError,\n toThrowUnauthorizedError,\n toThrowUnavailableError,\n} from \"./matchers/toThrowJaypieError.matcher.js\";\n\n// Combine all matchers\nconst matchers = {\n // Custom Jaypie matchers\n toBeCalledAboveTrace,\n toBeCalledWithInitialParams,\n toBeClass,\n toBeJaypieError,\n toBeMockFunction,\n toMatchBase64,\n toMatchJwt,\n toMatchMongoId,\n toMatchSignedCookie,\n toMatchSchema: jestJsonSchemaMatchers.toMatchSchema,\n toMatchUuid,\n toMatchUuid4,\n toMatchUuid5,\n toThrowBadGatewayError,\n toThrowBadRequestError,\n toThrowConfigurationError,\n toThrowError,\n toThrowForbiddenError,\n toThrowGatewayTimeoutError,\n toThrowInternalError,\n toThrowJaypieError,\n toThrowNotFoundError,\n toThrowUnauthorizedError,\n toThrowUnavailableError,\n\n // Include all jest-extended matchers\n ...jestExtendedMatchers,\n};\n\nexport default matchers;\n","import { log } from \"@jaypie/core\";\nimport { vi } from \"vitest\";\nimport { LogMock } from \"./types/jaypie-testkit\";\n\nexport function mockLogFactory(): LogMock {\n // Create skeleton of mock objects\n const mock = {\n debug: vi.fn(),\n error: vi.fn(),\n fatal: vi.fn(),\n info: vi.fn(),\n init: vi.fn(),\n lib: vi.fn(),\n tag: vi.fn(),\n trace: vi.fn(),\n untag: vi.fn(),\n var: vi.fn(),\n warn: vi.fn(),\n with: vi.fn(),\n } as LogMock;\n\n // Fill out nested mocks\n mock.debug.var = mock.var;\n mock.error.var = mock.var;\n mock.fatal.var = mock.var;\n mock.info.var = mock.var;\n mock.trace.var = mock.var;\n mock.warn.var = mock.var;\n\n // Have modules return correct objects\n mock.init.mockReturnValue(null);\n mock.lib.mockReturnValue(mock);\n mock.with.mockReturnValue(mock);\n\n // Pin mocks to the module\n mock.mock = {\n debug: mock.debug,\n error: mock.error,\n fatal: mock.fatal,\n info: mock.info,\n init: mock.init,\n lib: mock.lib,\n tag: mock.tag,\n trace: mock.trace,\n untag: mock.untag,\n var: mock.var,\n warn: mock.warn,\n with: mock.with,\n };\n\n return mock;\n}\n\nconst LOG_METHOD_NAMES = [\n \"debug\",\n \"error\",\n \"fatal\",\n \"info\",\n \"init\",\n \"lib\",\n \"tag\",\n \"trace\",\n \"untag\",\n \"var\",\n \"warn\",\n \"with\",\n] as const;\n\n// Use Record type for more flexible access pattern\nconst originalLogMethods = new WeakMap<typeof log, Record<string, unknown>>();\n\nexport function spyLog(logInstance: typeof log): void {\n if (!originalLogMethods.has(logInstance)) {\n const mockLog = mockLogFactory();\n const originalMethods: Record<string, unknown> = {};\n\n // Save only methods that actually exist on the log instance\n LOG_METHOD_NAMES.forEach((method) => {\n if (method in logInstance) {\n originalMethods[method] =\n logInstance[method as keyof typeof logInstance];\n // Use type assertion after checking existence\n (logInstance as Record<string, unknown>)[method] = mockLog[method];\n }\n });\n\n originalLogMethods.set(logInstance, originalMethods);\n }\n}\n\nexport function restoreLog(logInstance: typeof log): void {\n const originalMethods = originalLogMethods.get(logInstance);\n if (originalMethods) {\n LOG_METHOD_NAMES.forEach((method) => {\n if (method in originalMethods && method in logInstance) {\n // Use type assertion after checking existence\n (logInstance as Record<string, unknown>)[method] =\n originalMethods[method];\n }\n });\n originalLogMethods.delete(logInstance);\n }\n}\n","interface SQSEvent {\n Records: Array<{\n body: string;\n messageId?: string | number;\n [key: string]: unknown;\n }>;\n}\n\n/**\n * Creates a mock SQS event with the given records\n * @param records - Array of records or individual records to include in the event\n * @returns SQS event object with Records array\n */\nconst sqsTestRecords = (...records: Array<unknown>): SQSEvent => {\n // If first argument is an array, use that as records\n const recordsArray = Array.isArray(records[0]) ? records[0] : records;\n\n // Map records to SQS record format\n const formattedRecords = recordsArray.map((record) => {\n if (typeof record === \"object\" && record !== null) {\n return {\n ...record,\n body:\n typeof (record as { body?: unknown }).body === \"string\"\n ? (record as { body: string }).body\n : JSON.stringify((record as { body?: unknown }).body ?? record),\n };\n }\n return {\n body: String(record),\n };\n });\n\n return {\n Records: formattedRecords,\n };\n};\n\nexport default sqsTestRecords;\n"],"names":["isEqual","jsonSchemaMatchers","toBeCalledAboveTrace","jestJsonSchemaMatchers"],"mappings":";;;;;;AAAa,MAAA,GAAG,GAAG;AACjB,IAAA,KAAK,EAAE;AACL,QAAA,GAAG,EAAE,KAAK;AACV,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,IAAI,EAAE,M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,eAAe,EAAE;AACnB,QAAA,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,KAAI;YAClC,IAAI,MAAM,IAAI,eAAe,IAAI,MAAM,IAAI,WAAW,EAAE;;gBAErD,WAAuC,CAAC,MAAM,CAAC;oBAC9C,eAAe,CAAC,MAAM,CAAC;;AAE7B,SAAC,CAAC;AACF,QAAA,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC;;AAE1C;;AC9FA;;;;AAIG;AACH,MAAM,cAAc,GAAG,CAAC,GAAG,OAAuB,KAAc;;IAE9D,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO;;IAGrE,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,KAAI;QACnD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE;YACjD,OAAO;AACL,gBAAA,GAAG,MAAM;AACT,gBAAA,IAAI,EACF,OAAQ,MAA6B,CAAC,IAAI,KAAK;sBAC1C,MAA2B,CAAC;sBAC7B,IAAI,CAAC,SAAS,CAAE,MAA6B,CAAC,IAAI,IAAI,MAAM,CAAC;aACpE;;QAEH,OAAO;AACL,YAAA,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;SACrB;AACH,KAAC,CAAC;IAEF,OAAO;AACL,QAAA,OAAO,EAAE,gBAAgB;KAC1B;AACH;;;;"}
@@ -0,0 +1,10 @@
1
+ import type { Assertion } from "vitest";
2
+ declare module "vitest" {
3
+ interface Assertion<T = any> {
4
+ toBeMockFunction(): T;
5
+ }
6
+ }
7
+ export declare function toBeMockFunction(this: Assertion, received: unknown): {
8
+ message: () => string;
9
+ pass: boolean;
10
+ };
@@ -1,3 +1,4 @@
1
+ import { toBeMockFunction } from "./matchers/toBeMockFunction.matcher.js";
1
2
  declare const matchers: {
2
3
  pass(message: string): any;
3
4
  fail(message: string): any;
@@ -72,6 +73,7 @@ declare const matchers: {
72
73
  toBeCalledWithInitialParams: (received: import("vitest").Mock, ...passed: unknown[]) => import("./types/jaypie-testkit.js").MatcherResult;
73
74
  toBeClass: (received: unknown) => import("./types/jaypie-testkit.js").MatcherResult;
74
75
  toBeJaypieError: (received: unknown) => import("./types/jaypie-testkit.js").MatcherResult;
76
+ toBeMockFunction: typeof toBeMockFunction;
75
77
  toMatchBase64: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
76
78
  toMatchJwt: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
77
79
  toMatchMongoId: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
@@ -0,0 +1,22 @@
1
+ export declare const getMessages: (...args: unknown[]) => unknown;
2
+ export declare const getSecret: (...args: unknown[]) => Promise<string>;
3
+ export declare const sendMessage: (...args: unknown[]) => Promise<{
4
+ MessageId: string;
5
+ }>;
6
+ export declare const getEnvSecret: ((key: string) => Promise<string>) & {
7
+ mock: any;
8
+ };
9
+ export declare const getSingletonMessage: (...args: unknown[]) => unknown;
10
+ export declare const getTextractJob: ((jobId: string) => Promise<any>) & {
11
+ mock: any;
12
+ };
13
+ export declare const sendBatchMessages: (...args: unknown[]) => Promise<boolean>;
14
+ export declare const sendTextractJob: (({ bucket, key, featureTypes, }: {
15
+ bucket: string;
16
+ key: string;
17
+ featureTypes?: string[];
18
+ snsRoleArn?: string;
19
+ snsTopicArn?: string;
20
+ }) => Promise<any[]>) & {
21
+ mock: any;
22
+ };
@@ -0,0 +1,19 @@
1
+ export declare const LOG: {
2
+ readonly LEVEL: {
3
+ readonly ALL: "all";
4
+ readonly DEBUG: "debug";
5
+ readonly ERROR: "error";
6
+ readonly FATAL: "fatal";
7
+ readonly INFO: "info";
8
+ readonly SILENT: "silent";
9
+ readonly TRACE: "trace";
10
+ readonly WARN: "warn";
11
+ };
12
+ };
13
+ export declare const RE_BASE64_PATTERN: RegExp;
14
+ export declare const RE_JWT_PATTERN: RegExp;
15
+ export declare const RE_MONGO_ID_PATTERN: RegExp;
16
+ export declare const RE_SIGNED_COOKIE_PATTERN: RegExp;
17
+ export declare const RE_UUID_4_PATTERN: RegExp;
18
+ export declare const RE_UUID_5_PATTERN: RegExp;
19
+ export declare const RE_UUID_PATTERN: RegExp;