mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
17 lines
538 B
TypeScript
17 lines
538 B
TypeScript
import type { z } from 'zod';
|
|
|
|
expect.extend({
|
|
toMatchZod(this: jest.MatcherContext, actual: z.ZodTypeAny, expected: z.ZodTypeAny) {
|
|
const actualSerialized = JSON.stringify(actual._def, null, 2);
|
|
const expectedSerialized = JSON.stringify(expected._def, null, 2);
|
|
const pass = this.equals(actualSerialized, expectedSerialized);
|
|
|
|
return {
|
|
pass,
|
|
message: pass
|
|
? () => `Expected ${actualSerialized} not to match ${expectedSerialized}`
|
|
: () => `Expected ${actualSerialized} to match ${expectedSerialized}`,
|
|
};
|
|
},
|
|
});
|