From 9b3111b50e605fc2f998fdbe9cf135cd5fc58407 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Wed, 3 Apr 2024 04:52:00 +0800 Subject: [PATCH] add a test case --- tests/integration/tests/plugins/zod.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/tests/plugins/zod.test.ts b/tests/integration/tests/plugins/zod.test.ts index dd82f6786..d27d2bb45 100644 --- a/tests/integration/tests/plugins/zod.test.ts +++ b/tests/integration/tests/plugins/zod.test.ts @@ -2,6 +2,7 @@ /// import { loadSchema } from '@zenstackhq/testtools'; +import { randomUUID } from 'crypto'; import fs from 'fs'; import path from 'path'; @@ -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 } `; @@ -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 () => {