-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c6161f
commit 8a5075e
Showing
1 changed file
with
0 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,3 @@ | ||
import { z } from "./src"; | ||
|
||
z; | ||
|
||
/* eslint-env mocha */ | ||
|
||
// const { z, ZodError } = require('zod') | ||
|
||
// describe('zod', function () { | ||
// it('cannot deal with circular data structures', function () { | ||
const AnObjectSchema = z.object({ someLiteralProperty: z.literal(1) }); | ||
|
||
const cicrularObject: any = { | ||
aProperty: "a property", | ||
anotherProperty: 137, | ||
anObjectProperty: { anObjectPropertyProperty: "an object property property" }, | ||
anArrayProperty: [ | ||
{ anArrayObjectPropertyProperty: "an object property property" }, | ||
], | ||
}; | ||
cicrularObject.anObjectProperty.cicrularObject = cicrularObject; | ||
cicrularObject.anArrayProperty.push(cicrularObject.anObjectProperty); | ||
const violatingObject = { someLiteralProperty: cicrularObject }; | ||
|
||
const { success, error } = AnObjectSchema.safeParse(violatingObject); | ||
|
||
console.log({ success, error }); | ||
// }) | ||
// }) |