@jaypie/testkit 1.1.36 → 1.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,4 @@
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';
1
+ import { log } from '@jaypie/logger';
5
2
  import { Mock } from 'vitest';
6
3
 
7
4
  declare const LOG: {
@@ -17,10 +14,8 @@ declare const LOG: {
17
14
  };
18
15
  };
19
16
 
20
- interface MatcherResult {
21
- message: () => string;
22
- pass: boolean;
23
- }
17
+ type Log = typeof log;
18
+
24
19
 
25
20
  interface MockLogMethod extends Mock {
26
21
  var: Mock;
@@ -114,103 +109,7 @@ declare const jsonApiSchema: {
114
109
  readonly required: readonly ["data"];
115
110
  };
116
111
 
117
- declare function toBeMockFunction(received: unknown): MatcherResult;
118
-
119
- declare const matchers: {
120
- pass(message: string): any;
121
- fail(message: string): any;
122
- toBeEmpty(): any;
123
- toBeOneOf<E = unknown>(members: readonly E[]): any;
124
- toBeNil(): any;
125
- toSatisfy<E = any>(predicate: (x: E) => boolean): any;
126
- toBeArray(): any;
127
- toBeArrayOfSize(x: number): any;
128
- toBeAfter(date: Date): any;
129
- toBeBefore(date: Date): any;
130
- toIncludeAllMembers<E = unknown>(members: readonly E[]): any;
131
- toIncludeAnyMembers<E = unknown>(members: readonly E[]): any;
132
- toIncludeSameMembers<E = unknown>(members: readonly E[]): any;
133
- toPartiallyContain<E = unknown>(member: E): any;
134
- toSatisfyAll<E = any>(predicate: (x: E) => boolean): any;
135
- toSatisfyAny(predicate: (x: any) => boolean): any;
136
- toBeBoolean(): any;
137
- toBeTrue(): any;
138
- toBeFalse(): any;
139
- toBeDate(): any;
140
- toBeValidDate(): any;
141
- toBeFunction(): any;
142
- toBeDateString(): any;
143
- toBeHexadecimal(): any;
144
- toHaveBeenCalledBefore(mock: jest.MockInstance<any, any[]>, failIfNoSecondInvocation?: boolean): any;
145
- toHaveBeenCalledAfter(mock: jest.MockInstance<any, any[]>, failIfNoFirstInvocation?: boolean): any;
146
- toHaveBeenCalledOnce(): any;
147
- toHaveBeenCalledExactlyOnceWith(...args: unknown[]): any;
148
- toBeNumber(): any;
149
- toBeNaN(): any;
150
- toBeFinite(): any;
151
- toBePositive(): any;
152
- toBeNegative(): any;
153
- toBeEven(): any;
154
- toBeOdd(): any;
155
- toBeWithin(start: number, end: number): any;
156
- toBeInRange(min: number, max: number): any;
157
- toBeObject(): any;
158
- toContainKey(key: string): any;
159
- toContainKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
160
- toContainAllKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
161
- toContainAnyKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
162
- toContainValue<E = unknown>(value: E): any;
163
- toContainValues<E = unknown>(values: readonly E[]): any;
164
- toContainAllValues<E = unknown>(values: readonly E[]): any;
165
- toContainAnyValues<E = unknown>(values: readonly E[]): any;
166
- toContainEntry<E = unknown>(entry: readonly [keyof E, E[keyof E]]): any;
167
- toContainEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
168
- toContainAllEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
169
- toContainAnyEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
170
- toBeExtensible(): any;
171
- toBeFrozen(): any;
172
- toBeSealed(): any;
173
- toResolve(): any;
174
- toReject(): any;
175
- toBeString(): any;
176
- toEqualCaseInsensitive(string: string): any;
177
- toStartWith(prefix: string): any;
178
- toEndWith(suffix: string): any;
179
- toInclude(substring: string): any;
180
- toIncludeRepeated(substring: string, times: number): any;
181
- toIncludeMultiple(substring: readonly string[]): any;
182
- toThrowWithMessage(type: (...args: any[]) => any, message: string | RegExp): any;
183
- toBeEmptyObject(): any;
184
- toBeSymbol(): any;
185
- toBeBetween(startDate: Date, endDate: Date): any;
186
- toBeBeforeOrEqualTo(date: Date): any;
187
- toBeAfterOrEqualTo(date: Date): any;
188
- toEqualIgnoringWhitespace(string: string): any;
189
- toBeCalledAboveTrace: (log: LogMock) => MatcherResult;
190
- toBeCalledWithInitialParams: (received: vitest.Mock, ...passed: unknown[]) => MatcherResult;
191
- toBeClass: (received: unknown) => MatcherResult;
192
- toBeJaypieError: (received: unknown) => MatcherResult;
193
- toBeMockFunction: typeof toBeMockFunction;
194
- toMatchBase64: (subject: string) => MatcherResult;
195
- toMatchJwt: (subject: string) => MatcherResult;
196
- toMatchMongoId: (subject: string) => MatcherResult;
197
- toMatchSignedCookie: (subject: string) => MatcherResult;
198
- toMatchSchema: (received: unknown, schema: object) => jest_json_schema.JsonSchemaMatcherResult;
199
- toMatchUuid: (subject: string) => MatcherResult;
200
- toMatchUuid4: (subject: string) => MatcherResult;
201
- toMatchUuid5: (subject: string) => MatcherResult;
202
- toThrowBadGatewayError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
203
- toThrowBadRequestError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
204
- toThrowConfigurationError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
205
- toThrowError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
206
- toThrowForbiddenError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
207
- toThrowGatewayTimeoutError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
208
- toThrowInternalError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
209
- toThrowJaypieError: (received: () => unknown | Promise<unknown>, expected?: _jaypie_core.ProjectError | (() => _jaypie_core.ProjectError) | (new () => _jaypie_core.ProjectError)) => Promise<MatcherResult>;
210
- toThrowNotFoundError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
211
- toThrowUnauthorizedError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
212
- toThrowUnavailableError: (received: () => unknown | Promise<unknown>) => Promise<MatcherResult>;
213
- };
112
+ declare const matchers: Record<string, (...args: any[]) => any>;
214
113
 
215
114
  declare function mockLogFactory(): LogMock;
216
115
  declare function spyLog(logInstance: typeof log): void;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ 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
4
  import { vi } from 'vitest';
5
- import { isJaypieError, UnauthorizedError, NotFoundError, InternalError, GatewayTimeoutError, ForbiddenError, ConfigurationError, BadRequestError, BadGatewayError, UnavailableError } from '@jaypie/core';
5
+ import { isJaypieError, UnauthorizedError, NotFoundError, InternalError, GatewayTimeoutError, ForbiddenError, ConfigurationError, BadRequestError, BadGatewayError, UnavailableError } from '@jaypie/errors';
6
6
 
7
7
  const LOG = {
8
8
  LEVEL: {
@@ -439,7 +439,8 @@ function spyLog(logInstance) {
439
439
  originalMethods[method] =
440
440
  logInstance[method];
441
441
  // Use type assertion after checking existence
442
- logInstance[method] = mockLog[method];
442
+ logInstance[method] =
443
+ mockLog[method];
443
444
  }
444
445
  });
445
446
  originalLogMethods.set(logInstance, originalMethods);
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/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 { MatcherResult } from \"../types/jaypie-testkit\";\n\nexport function toBeMockFunction(received: unknown): MatcherResult {\n const pass = typeof received === \"function\" && vi.isMockFunction(received);\n\n return {\n message: () =>\n `expected ${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":";;;;;;AAAO,MAAM,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;;ACpBtE,MAAM,kBAAkB,GAAG;AAChC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,UAAU,EAAE;AACV,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,KAAK,EAAE;AACL,gBAAA,IAAI,EAAE,QAAQ;AACd,g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B,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;QACH;QACA,OAAO;AACL,YAAA,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;SACrB;AACH,IAAA,CAAC,CAAC;IAEF,OAAO;AACL,QAAA,OAAO,EAAE,gBAAgB;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 { MatcherResult } from \"../types/jaypie-testkit\";\n\nexport function toBeMockFunction(received: unknown): MatcherResult {\n const pass = typeof received === \"function\" && vi.isMockFunction(received);\n\n return {\n message: () =>\n `expected ${received} ${pass ? \"not \" : \"\"}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 JaypieError,\n NotFoundError,\n UnauthorizedError,\n UnavailableError,\n} from \"@jaypie/errors\";\nimport { MatcherResult } from \"../types/jaypie-testkit\";\n\n// Define a more specific type for JaypieError with _type field\ntype JaypieErrorInstance = InstanceType<typeof JaypieError>;\ntype JaypieErrorWithType = JaypieErrorInstance & { _type: string };\n\n//\n//\n// Main\n//\n\ntype ReceivedFunction = () => unknown | Promise<unknown>;\ntype ErrorConstructor = new () => JaypieErrorInstance;\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?:\n | JaypieErrorInstance\n | (() => JaypieErrorInstance)\n | ErrorConstructor,\n): Promise<MatcherResult> => {\n const isAsync =\n received.constructor.name === \"AsyncFunction\" ||\n received.constructor.name === \"Promise\";\n\n let expectedError: JaypieErrorInstance | 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: Record<string, (...args: any[]) => any> = {\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/logger\";\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 unknown as Record<string, unknown>)[method] =\n 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 unknown 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":";;;;;;AAAO,MAAM,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;;ACpBtE,MAAM,kBAAkB,GAAG;AAChC,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,UAAU,EAAE;AACV,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,KAAK,EAAE;AACL,gBAAA,IAAI,EAAE,QAAQ;AACd,gBAAA,UAAU,EAAE;AACV,oBAAA,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC1B,oBAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AACzB,oBAAA,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC3B,iBAAA;AACD,gBAAA,Q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,MAA2B,CAAC;sBAC7B,IAAI,CAAC,SAAS,CAAE,MAA6B,CAAC,IAAI,IAAI,MAAM,CAAC;aACpE;QACH;QACA,OAAO;AACL,YAAA,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;SACrB;AACH,IAAA,CAAC,CAAC;IAEF,OAAO;AACL,QAAA,OAAO,EAAE,gBAAgB;KAC1B;AACH;;;;"}
@@ -1,8 +1,9 @@
1
- import { ProjectError } from "@jaypie/core";
1
+ import { JaypieError } from "@jaypie/errors";
2
2
  import { MatcherResult } from "../types/jaypie-testkit";
3
+ type JaypieErrorInstance = InstanceType<typeof JaypieError>;
3
4
  type ReceivedFunction = () => unknown | Promise<unknown>;
4
- type ErrorConstructor = new () => ProjectError;
5
- declare const toThrowJaypieError: (received: ReceivedFunction, expected?: ProjectError | (() => ProjectError) | ErrorConstructor) => Promise<MatcherResult>;
5
+ type ErrorConstructor = new () => JaypieErrorInstance;
6
+ declare const toThrowJaypieError: (received: ReceivedFunction, expected?: JaypieErrorInstance | (() => JaypieErrorInstance) | ErrorConstructor) => Promise<MatcherResult>;
6
7
  declare const toThrowBadGatewayError: (received: ReceivedFunction) => Promise<MatcherResult>;
7
8
  declare const toThrowBadRequestError: (received: ReceivedFunction) => Promise<MatcherResult>;
8
9
  declare const toThrowConfigurationError: (received: ReceivedFunction) => Promise<MatcherResult>;
@@ -1,97 +1,2 @@
1
- import { toBeMockFunction } from "./matchers/toBeMockFunction.matcher.js";
2
- declare const matchers: {
3
- pass(message: string): any;
4
- fail(message: string): any;
5
- toBeEmpty(): any;
6
- toBeOneOf<E = unknown>(members: readonly E[]): any;
7
- toBeNil(): any;
8
- toSatisfy<E = any>(predicate: (x: E) => boolean): any;
9
- toBeArray(): any;
10
- toBeArrayOfSize(x: number): any;
11
- toBeAfter(date: Date): any;
12
- toBeBefore(date: Date): any;
13
- toIncludeAllMembers<E = unknown>(members: readonly E[]): any;
14
- toIncludeAnyMembers<E = unknown>(members: readonly E[]): any;
15
- toIncludeSameMembers<E = unknown>(members: readonly E[]): any;
16
- toPartiallyContain<E = unknown>(member: E): any;
17
- toSatisfyAll<E = any>(predicate: (x: E) => boolean): any;
18
- toSatisfyAny(predicate: (x: any) => boolean): any;
19
- toBeBoolean(): any;
20
- toBeTrue(): any;
21
- toBeFalse(): any;
22
- toBeDate(): any;
23
- toBeValidDate(): any;
24
- toBeFunction(): any;
25
- toBeDateString(): any;
26
- toBeHexadecimal(): any;
27
- toHaveBeenCalledBefore(mock: jest.MockInstance<any, any[]>, failIfNoSecondInvocation?: boolean): any;
28
- toHaveBeenCalledAfter(mock: jest.MockInstance<any, any[]>, failIfNoFirstInvocation?: boolean): any;
29
- toHaveBeenCalledOnce(): any;
30
- toHaveBeenCalledExactlyOnceWith(...args: unknown[]): any;
31
- toBeNumber(): any;
32
- toBeNaN(): any;
33
- toBeFinite(): any;
34
- toBePositive(): any;
35
- toBeNegative(): any;
36
- toBeEven(): any;
37
- toBeOdd(): any;
38
- toBeWithin(start: number, end: number): any;
39
- toBeInRange(min: number, max: number): any;
40
- toBeObject(): any;
41
- toContainKey(key: string): any;
42
- toContainKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
43
- toContainAllKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
44
- toContainAnyKeys<E = unknown>(keys: readonly (string | keyof E)[]): any;
45
- toContainValue<E = unknown>(value: E): any;
46
- toContainValues<E = unknown>(values: readonly E[]): any;
47
- toContainAllValues<E = unknown>(values: readonly E[]): any;
48
- toContainAnyValues<E = unknown>(values: readonly E[]): any;
49
- toContainEntry<E = unknown>(entry: readonly [keyof E, E[keyof E]]): any;
50
- toContainEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
51
- toContainAllEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
52
- toContainAnyEntries<E = unknown>(entries: readonly (readonly [keyof E, E[keyof E]])[]): any;
53
- toBeExtensible(): any;
54
- toBeFrozen(): any;
55
- toBeSealed(): any;
56
- toResolve(): any;
57
- toReject(): any;
58
- toBeString(): any;
59
- toEqualCaseInsensitive(string: string): any;
60
- toStartWith(prefix: string): any;
61
- toEndWith(suffix: string): any;
62
- toInclude(substring: string): any;
63
- toIncludeRepeated(substring: string, times: number): any;
64
- toIncludeMultiple(substring: readonly string[]): any;
65
- toThrowWithMessage(type: (...args: any[]) => any, message: string | RegExp): any;
66
- toBeEmptyObject(): any;
67
- toBeSymbol(): any;
68
- toBeBetween(startDate: Date, endDate: Date): any;
69
- toBeBeforeOrEqualTo(date: Date): any;
70
- toBeAfterOrEqualTo(date: Date): any;
71
- toEqualIgnoringWhitespace(string: string): any;
72
- toBeCalledAboveTrace: (log: import("./types/jaypie-testkit.js").LogMock) => import("./types/jaypie-testkit.js").MatcherResult;
73
- toBeCalledWithInitialParams: (received: import("vitest").Mock, ...passed: unknown[]) => import("./types/jaypie-testkit.js").MatcherResult;
74
- toBeClass: (received: unknown) => import("./types/jaypie-testkit.js").MatcherResult;
75
- toBeJaypieError: (received: unknown) => import("./types/jaypie-testkit.js").MatcherResult;
76
- toBeMockFunction: typeof toBeMockFunction;
77
- toMatchBase64: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
78
- toMatchJwt: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
79
- toMatchMongoId: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
80
- toMatchSignedCookie: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
81
- toMatchSchema: (received: unknown, schema: object) => import("jest-json-schema").JsonSchemaMatcherResult;
82
- toMatchUuid: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
83
- toMatchUuid4: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
84
- toMatchUuid5: (subject: string) => import("./types/jaypie-testkit.js").MatcherResult;
85
- toThrowBadGatewayError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
86
- toThrowBadRequestError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
87
- toThrowConfigurationError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
88
- toThrowError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
89
- toThrowForbiddenError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
90
- toThrowGatewayTimeoutError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
91
- toThrowInternalError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
92
- toThrowJaypieError: (received: () => unknown | Promise<unknown>, expected?: import("@jaypie/core").ProjectError | (() => import("@jaypie/core").ProjectError) | (new () => import("@jaypie/core").ProjectError)) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
93
- toThrowNotFoundError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
94
- toThrowUnauthorizedError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
95
- toThrowUnavailableError: (received: () => unknown | Promise<unknown>) => Promise<import("./types/jaypie-testkit.js").MatcherResult>;
96
- };
1
+ declare const matchers: Record<string, (...args: any[]) => any>;
97
2
  export default matchers;