main
1import { describe, expect, test } from "bun:test";
2
3import { multiSelectInputPrompt, parseMultiSelectAnswer } from "./ask-user-utils";
4
5describe("multiSelectInputPrompt", () => {
6 test("presents the question, options, and comma-separated input instruction for RPC", () => {
7 expect(multiSelectInputPrompt("Which features?", ["auth", "logging", "caching"])).toBe(
8 "Which features?\n\nOptions: auth, logging, caching\nEnter one or more choices, separated by commas:",
9 );
10 });
11});
12
13describe("parseMultiSelectAnswer", () => {
14 test("returns trimmed comma-separated selections", () => {
15 expect(parseMultiSelectAnswer(" auth, logging ,caching ")).toEqual(["auth", "logging", "caching"]);
16 });
17
18 test("returns no selection for cancellation or blank input", () => {
19 expect(parseMultiSelectAnswer(undefined)).toEqual([]);
20 expect(parseMultiSelectAnswer(" , ")).toEqual([]);
21 });
22});