Tests
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Julien Valverdé
2024-03-18 17:15:15 +01:00
parent 4d96ddfa2b
commit aa3987e372

View File

@@ -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<typeof userExp> {}
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<typeof adminUserExp> {}
const admin = AdminUser.create({ id: 2n, name: "Admin" })
const admin = AdminUser.create({ id: Option.some(2n), name: "Admin" })