fix: harden phase summary open questions
This commit is contained in:
@@ -151,6 +151,22 @@ test("validatePhaseSummaryV2: rejects a section missing title or items", () => {
|
||||
assert.ok(out.errors.some((e) => /sections\[0\].*title/.test(e)));
|
||||
});
|
||||
|
||||
test("validatePhaseSummaryV2: rejects structured open_questions instead of crashing the UI", () => {
|
||||
const out = validatePhaseSummaryV2({
|
||||
schema_version: 2,
|
||||
summary: "s",
|
||||
open_questions: [
|
||||
{
|
||||
label: "pazienti_finale restituisce 0 righe",
|
||||
question: "Verificare se i filtri sono troppo restrittivi",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
assert.equal(out.ok, false);
|
||||
assert.ok(out.errors.some((error) => /open_questions\[0\]/.test(error)));
|
||||
});
|
||||
|
||||
test("validatePhaseSummaryV2: permissive on extra unknown fields", () => {
|
||||
const out = validatePhaseSummaryV2({ schema_version: 2, summary: "s", extra_field_from_model: "whatever" });
|
||||
assert.equal(out.ok, true);
|
||||
|
||||
Reference in New Issue
Block a user