fix: align ask_user payload validation

This commit is contained in:
Erik Kotsiuba
2026-08-12 14:18:22 +02:00
parent 0145055445
commit 852e625d86
10 changed files with 242 additions and 75 deletions
+30
View File
@@ -254,6 +254,36 @@ test("normalize trims ids, prompts, and option text", () => {
});
});
test("normalize treats blank optional presentation text as absent", () => {
const state = createInitialState({
title: " ",
questions: [
{
id: "scope",
label: " ",
prompt: "Pick scope",
options: [
{
value: "small",
label: "Small",
description: " ",
preview: "\t",
},
],
},
],
});
assert.equal(state.title, undefined);
assert.equal(state.questions[0].label, "Q1");
assert.deepEqual(state.questions[0].options[0], {
value: "small",
label: "Small",
description: undefined,
preview: undefined,
});
});
test("single-select number shortcut stores answer and advances to next tab", () => {
let state = createInitialState(sampleParams());
state = applyNumberShortcut(state, 2);