fix(tests): repair test regressions from zod v3 downgrade
- Fix zod/v4 imports in background-task schema tests - Remove ZWSP prefix from agent-key-remapper test (fixed in #3136) - Use toMatchObject for openai-only catalog tests (fallback_models added by #3144) - Replace z.toJSONSchema (zod v4) with zodToJsonSchema (zod v3 compat) - Fix task-list.ts type narrowing for zod v3 inferred types
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import * as z from "zod"
|
import { zodToJsonSchema } from "zod-to-json-schema"
|
||||||
import { OhMyOpenCodeConfigSchema } from "../src/config/schema"
|
import { OhMyOpenCodeConfigSchema } from "../src/config/schema"
|
||||||
|
|
||||||
export function createOhMyOpenCodeJsonSchema(): Record<string, unknown> {
|
export function createOhMyOpenCodeJsonSchema(): Record<string, unknown> {
|
||||||
const jsonSchema = z.toJSONSchema(OhMyOpenCodeConfigSchema, {
|
const jsonSchema = zodToJsonSchema(OhMyOpenCodeConfigSchema, {
|
||||||
target: "draft-7",
|
target: "jsonSchema7",
|
||||||
unrepresentable: "any",
|
$refStrategy: "none",
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ describe("generateModelConfig OpenAI-only model catalog", () => {
|
|||||||
const result = generateModelConfig(config)
|
const result = generateModelConfig(config)
|
||||||
|
|
||||||
// #then
|
// #then
|
||||||
expect(result.agents?.explore).toEqual({ model: "opencode-go/minimax-m2.7" })
|
expect(result.agents?.explore).toMatchObject({ model: "opencode-go/minimax-m2.7" })
|
||||||
expect(result.agents?.librarian).toEqual({ model: "opencode-go/minimax-m2.7" })
|
expect(result.agents?.librarian).toMatchObject({ model: "opencode-go/minimax-m2.7" })
|
||||||
expect(result.categories?.quick).toEqual({ model: "openai/gpt-5.4-mini" })
|
expect(result.categories?.quick).toMatchObject({ model: "openai/gpt-5.4-mini" })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
import { describe, expect, test } from "bun:test"
|
||||||
import { ZodError } from "zod/v4"
|
import { ZodError } from "zod"
|
||||||
import { BackgroundTaskConfigSchema } from "./background-task"
|
import { BackgroundTaskConfigSchema } from "./background-task"
|
||||||
|
|
||||||
describe("BackgroundTaskConfigSchema.circuitBreaker", () => {
|
describe("BackgroundTaskConfigSchema.circuitBreaker", () => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
import { describe, expect, test } from "bun:test"
|
||||||
import { ZodError } from "zod/v4"
|
import { ZodError } from "zod"
|
||||||
import { BackgroundTaskConfigSchema } from "./background-task"
|
import { BackgroundTaskConfigSchema } from "./background-task"
|
||||||
|
|
||||||
describe("BackgroundTaskConfigSchema", () => {
|
describe("BackgroundTaskConfigSchema", () => {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ describe("remapAgentKeysToDisplayNames", () => {
|
|||||||
expect(result["hephaestus"]).toBeUndefined()
|
expect(result["hephaestus"]).toBeUndefined()
|
||||||
expect(result["Prometheus (Plan Builder)"]).toBeDefined()
|
expect(result["Prometheus (Plan Builder)"]).toBeDefined()
|
||||||
expect(result["prometheus"]).toBeUndefined()
|
expect(result["prometheus"]).toBeUndefined()
|
||||||
expect(result["\u200BAtlas (Plan Executor)"]).toBeDefined()
|
expect(result["Atlas (Plan Executor)"]).toBeDefined()
|
||||||
expect(result["atlas"]).toBeUndefined()
|
expect(result["atlas"]).toBeUndefined()
|
||||||
expect(result["Athena (Council)"]).toBeDefined()
|
expect(result["Athena (Council)"]).toBeDefined()
|
||||||
expect(result["athena"]).toBeUndefined()
|
expect(result["athena"]).toBeUndefined()
|
||||||
|
|||||||
Reference in New Issue
Block a user