@@ -306,7 +306,7 @@ describe("ACP elicitation question parsing and answer serialization", () => {
306306 ]);
307307 });
308308
309- it("skips empty choice options and does not emit blank values or labels", () => {
309+ it("skips empty choice options and does not emit blank values or labels while preserving nonblank whitespace ", () => {
310310 const questions = parseElicitationQuestions({
311311 message: "Select option",
312312 requestedSchema: {
@@ -317,9 +317,13 @@ describe("ACP elicitation question parsing and answer serialization", () => {
317317 oneOf: [
318318 { const: "", title: "" },
319319 { const: " ", title: "Blank" },
320- { const: "valid", title: "Valid Option", description: "Good choice" },
320+ { const: " valid ", title: "Valid Option", description: "Good choice" },
321321 ],
322322 },
323+ enumChoice: {
324+ type: "string",
325+ enum: [" ", " option with space "],
326+ },
323327 },
324328 },
325329 });
@@ -329,7 +333,20 @@ describe("ACP elicitation question parsing and answer serialization", () => {
329333 id: "choice",
330334 header: "Question 1",
331335 question: "Select option",
332- options: [{ label: "Valid Option", description: "Good choice", value: "valid" }],
336+ options: [{ label: "Valid Option", description: "Good choice", value: " valid " }],
337+ allowCustomAnswer: false,
338+ },
339+ {
340+ id: "enumChoice",
341+ header: "Question 2",
342+ question: "Select option",
343+ options: [
344+ {
345+ label: " option with space ",
346+ description: " option with space ",
347+ value: " option with space ",
348+ },
349+ ],
333350 allowCustomAnswer: false,
334351 },
335352 ]);
@@ -378,7 +395,8 @@ describe("ACP elicitation question parsing and answer serialization", () => {
378395 invalidPort: { type: "number" },
379396 tags: { type: "array" },
380397 singleTag: { type: "array" },
381- limitedTags: { type: "array", maxItems: 2 },
398+ limitedTagsFail: { type: "array", maxItems: 2 },
399+ limitedTagsPass: { type: "array", maxItems: 2 },
382400 minTagsPass: { type: "array", minItems: 2 },
383401 minTagsFail: { type: "array", minItems: 2 },
384402 title: { type: "string" },
@@ -397,7 +415,8 @@ describe("ACP elicitation question parsing and answer serialization", () => {
397415 invalidPort: "not-a-number",
398416 tags: ["a", "b"],
399417 singleTag: "single",
400- limitedTags: ["tag1", "tag2", "tag3"],
418+ limitedTagsFail: ["tag1", "tag2", "tag3"],
419+ limitedTagsPass: ["tag1", "tag2"],
401420 minTagsPass: ["tag1", "tag2"],
402421 minTagsFail: ["tag1"],
403422 title: "my-title",
@@ -414,7 +433,7 @@ describe("ACP elicitation question parsing and answer serialization", () => {
414433 boundedNumber: 25,
415434 tags: ["a", "b"],
416435 singleTag: ["single"],
417- limitedTags : ["tag1", "tag2"],
436+ limitedTagsPass : ["tag1", "tag2"],
418437 minTagsPass: ["tag1", "tag2"],
419438 title: "my-title",
420439 fromArray: "first",
@@ -424,6 +443,7 @@ describe("ACP elicitation question parsing and answer serialization", () => {
424443 assert.isFalse("underMin" in content);
425444 assert.isFalse("overMax" in content);
426445 assert.isFalse("invalidPort" in content);
446+ assert.isFalse("limitedTagsFail" in content);
427447 assert.isFalse("minTagsFail" in content);
428448 assert.isFalse("unknownKey" in content);
429449 });
0 commit comments