diff --git a/src/tests.ts b/src/tests.ts index f8434d6..d63a63c 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -1,15 +1,17 @@ import { Implements } from "@thilawyn/traitify-ts" +import { Option } from "effect" import { z } from "zod" import { JsonifiedZodSchemaClass } from "./JsonifiedZodSchemaClass" import { ZodSchemaClass } from "./ZodSchemaClass" import { dejsonify, jsonify } from "./schema/jsonifiable" +import { effect } from "./schema/lib" import { MobXObservableZodSchemaObject } from "./traits/MobXObservableZodSchemaObject" const userExp = ZodSchemaClass( z.object({ /** User ID */ - id: z.bigint().default(-1n), + id: effect.option.option(z.bigint()).default(Option.none()), /** Username */ name: z.string(), @@ -24,8 +26,8 @@ const userExp = ZodSchemaClass( @userExp.staticImplements class User extends userExp.extends implements Implements {} -const userInst = User.create({ id: 1n, name: "User" }) -const userInstEffect = User.createEffect({ id: 1n, name: "User" }) +const userInst = User.create({ id: Option.some(1n), name: "User" }) +const userInstEffect = User.createEffect({ id: Option.some(1n), name: "User" }) const jsonifiedUserExp = JsonifiedZodSchemaClass(User, { @@ -52,4 +54,4 @@ const adminUserExp = User.extend(s => s.extend({ @adminUserExp.staticImplements class AdminUser extends adminUserExp.extends implements Implements {} -const admin = AdminUser.create({ id: 2n, name: "Admin" }) +const admin = AdminUser.create({ id: Option.some(2n), name: "Admin" })