Skip to content

Commit 31eec77

Browse files
committed
test: transform
1 parent 1a3439a commit 31eec77

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ fake(px) // '100px'
9292
- .intersection 🚧
9393
- .refine ❌
9494
- .superRefine ❌
95-
- .transform 🚧
9695

9796
## About
9897

tests/mini.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,14 @@ const validSuits: { schema: z.ZodMiniType; description?: string; only?: boolean;
596596
description: 'refinement',
597597
},
598598

599-
// TODO: transform
600-
// { schema: z.transform(val => String(val)) },
599+
// transform
600+
{
601+
schema: z.pipe(
602+
z.string(),
603+
z.transform(val => val.length),
604+
),
605+
description: 'transform',
606+
},
601607

602608
// tuple
603609
{

tests/zod.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,10 @@ const validSuits: { schema: z.ZodType; description?: string; only?: boolean; asy
598598
},
599599

600600
// TODO: transform
601-
// { schema: z.transform(val => String(val)) },
601+
{
602+
schema: z.string().pipe(z.transform(val => val.length)),
603+
description: 'transform',
604+
},
602605

603606
// tuple
604607
{

0 commit comments

Comments
 (0)