test(core): cover Effect Schema event definitions

Exercise the new SyncEvent and BusEvent Schema overloads end to end and use Schema.isSchema for the conversion check so the mixed-schema path stays explicit and covered.
This commit is contained in:
Kit Langton
2026-04-23 08:43:35 -04:00
parent 3085279724
commit 96039bdb83
4 changed files with 67 additions and 6 deletions
+1 -5
View File
@@ -23,16 +23,12 @@ export function define<Type extends string, P extends ZodType>(
properties: P,
): { type: Type; properties: P }
export function define(type: string, properties: unknown) {
const zodProperties = isEffectSchema(properties) ? zod(properties) : (properties as ZodType)
const zodProperties = Schema.isSchema(properties) ? zod(properties) : (properties as ZodType)
const result = { type, properties: zodProperties }
registry.set(type, result as Definition)
return result
}
function isEffectSchema(value: unknown): value is Schema.Top {
return typeof value === "object" && value !== null && "ast" in value
}
export function payloads() {
return registry
.entries()
+1 -1
View File
@@ -117,7 +117,7 @@ export function define<
}
function toZodObject(value: ZodObject | Schema.Top): z.ZodObject {
if (typeof value === "object" && value !== null && "ast" in value) {
if (Schema.isSchema(value)) {
return zod(value as Schema.Top) as unknown as z.ZodObject
}
return value as z.ZodObject