| 1 | import * as Schema from "effect/Schema"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { OrchestrationV2UserInputQuestion } from "./orchestrationV2.ts"; |
| 5 | import { UserInputQuestion } from "./providerRuntime.ts"; |
| 6 | |
| 7 | const question = { id: "editor", header: "Message", question: "Edit message", options: [] }; |
| 8 | |
| 9 | describe("initial user input answers", () => { |
| 10 | it("keeps existing question payloads compatible and preserves exact initial text", () => { |
| 11 | for (const schema of [UserInputQuestion, OrchestrationV2UserInputQuestion]) { |
| 12 | const decode = Schema.decodeUnknownSync(schema); |
| 13 | expect(decode(question).initialAnswer).toBeUndefined(); |
| 14 | for (const initialAnswer of [ |
| 15 | "", |
| 16 | " fix(server): keep whitespace\n\n", |
| 17 | "detail\n".repeat(500), |
| 18 | ]) { |
| 19 | expect(decode({ ...question, initialAnswer }).initialAnswer).toBe(initialAnswer); |
| 20 | } |
| 21 | } |
| 22 | }); |
| 23 | }); |