This commit is contained in:
12
src/tests.ts
12
src/tests.ts
@@ -1,7 +1,7 @@
|
||||
import { pipeInto } from "ts-functional-pipe"
|
||||
import { z } from "zod"
|
||||
import { extendSchemableClass, makeSchemableClass, newSchemable } from "."
|
||||
import { makeJsonifiableSchemableClass } from "./jsonifiable"
|
||||
import { dejsonifySchemable, makeJsonifiableSchemableClass } from "./jsonifiable"
|
||||
import { dejsonifyBigIntSchema, jsonifyBigIntSchema } from "./legacy/jsonifiable"
|
||||
|
||||
|
||||
@@ -49,11 +49,13 @@ class User extends pipeInto(
|
||||
|
||||
|
||||
const user1 = newSchemable(User, { id: 1n, name: "User" })
|
||||
console.log(user1.jsonify())
|
||||
const jsonifiedUser1 = user1.jsonify()
|
||||
console.log(jsonifiedUser1)
|
||||
console.log(dejsonifySchemable(User, jsonifiedUser1))
|
||||
|
||||
|
||||
const UserWithPhone = extendSchemableClass(User, {
|
||||
schema: schema => schema.extend({
|
||||
schema: ({ schema }) => schema.extend({
|
||||
phone: z.string()
|
||||
}),
|
||||
|
||||
@@ -66,5 +68,5 @@ const UserWithPhone = extendSchemableClass(User, {
|
||||
UserWithPhone.schema
|
||||
|
||||
|
||||
const user2 = newSchemable(UserWithPhone, { id: 1n, name: "User" })
|
||||
console.log(user2.jsonify())
|
||||
// const user2 = newSchemable(UserWithPhone, { id: 1n, name: "User" })
|
||||
// console.log(user2.jsonify())
|
||||
|
||||
Reference in New Issue
Block a user