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 { Implements } from "@thilawyn/traitify-ts"
import { Option } from "effect"
import { z } from "zod" import { z } from "zod"
import { JsonifiedZodSchemaClass } from "./JsonifiedZodSchemaClass" import { JsonifiedZodSchemaClass } from "./JsonifiedZodSchemaClass"
import { ZodSchemaClass } from "./ZodSchemaClass" import { ZodSchemaClass } from "./ZodSchemaClass"
import { dejsonify, jsonify } from "./schema/jsonifiable" import { dejsonify, jsonify } from "./schema/jsonifiable"
import { effect } from "./schema/lib"
import { MobXObservableZodSchemaObject } from "./traits/MobXObservableZodSchemaObject" import { MobXObservableZodSchemaObject } from "./traits/MobXObservableZodSchemaObject"
const userExp = ZodSchemaClass( const userExp = ZodSchemaClass(
z.object({ z.object({
/** User ID */ /** User ID */
id: z.bigint().default(-1n), id: effect.option.option(z.bigint()).default(Option.none()),
/** Username */ /** Username */
name: z.string(), name: z.string(),
@@ -24,8 +26,8 @@ const userExp = ZodSchemaClass(
@userExp.staticImplements @userExp.staticImplements
class User extends userExp.extends implements Implements<typeof userExp> {} class User extends userExp.extends implements Implements<typeof userExp> {}
const userInst = User.create({ id: 1n, name: "User" }) const userInst = User.create({ id: Option.some(1n), name: "User" })
const userInstEffect = User.createEffect({ id: 1n, name: "User" }) const userInstEffect = User.createEffect({ id: Option.some(1n), name: "User" })
const jsonifiedUserExp = JsonifiedZodSchemaClass(User, { const jsonifiedUserExp = JsonifiedZodSchemaClass(User, {
@@ -52,4 +54,4 @@ const adminUserExp = User.extend(s => s.extend({
@adminUserExp.staticImplements @adminUserExp.staticImplements
class AdminUser extends adminUserExp.extends implements Implements<typeof adminUserExp> {} 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" })