Skip to content

Commit

Permalink
test: preserve literal string values for parsing from db
Browse files Browse the repository at this point in the history
  • Loading branch information
velut committed Apr 20, 2024
1 parent 0d4d081 commit 9f2e96c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/json-strip.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { z } from "zod";

const Literal = z.union([
// Truncate strings and numbers to save space in the test DB.
z.string().transform(() => ""),
// Truncate strings and numbers to save space in the test DB
// but preserve the `type` property literal values.
z.string().transform((val) => (["module", "commonjs"].includes(val) ? val : "")),
z.number().transform(() => 0),
z.boolean(),
z.null(),
Expand Down

0 comments on commit 9f2e96c

Please sign in to comment.