Skip to content

Commit

Permalink
add a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 committed Apr 2, 2024
1 parent c98c758 commit 9b3111b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/integration/tests/plugins/zod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// <reference types="@types/jest" />

import { loadSchema } from '@zenstackhq/testtools';
import { randomUUID } from 'crypto';
import fs from 'fs';
import path from 'path';

Expand Down Expand Up @@ -235,6 +236,7 @@ describe('Zod plugin tests', () => {
o Int? @lt(1, 'must be less than 1')
p Int? @lte(1, 'must be less than or equal to 1')
q Int[]
r String? @db.Uuid
}
`;

Expand Down Expand Up @@ -295,6 +297,9 @@ describe('Zod plugin tests', () => {

expect(schema.safeParse({ q: [1] }).success).toBeTruthy();
expect(schema.safeParse({ q: ['abc'] }).success).toBeFalsy();

expect(schema.safeParse({ r: 'abc' }).success).toBeFalsy();
expect(schema.safeParse({ r: randomUUID() }).success).toBeTruthy();
});

it('refinement scalar fields', async () => {
Expand Down

0 comments on commit 9b3111b

Please sign in to comment.