| 1 | package workbench |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestCLIStartupDialogs(t *testing.T) { |
| 6 | for _, tc := range []struct{ text, want string }{ |
| 7 | {"\x1b[31mWARNING: Loading development channels\x1b[0m\r\nChannels: server:cage\r\nI am using this for local development", "channel"}, |
| 8 | {"Quick safety check: is this a project you created or one you trust?\r\n/work/project\r\nYes, I trust this folder", "project"}, |
| 9 | {"Quick safety check: is this a project you created or one you trust? /other/project Yes, I trust this folder", ""}, |
| 10 | {"WARNING: Loading development channels Channels: server:other I am using this for local development", ""}, |
| 11 | {"WARNING: Loading development channels Channels: server:cage-extra 1. I am using this for local development", ""}, |
| 12 | {"WARNING: Loading development channels Channels: server:cage,server:other 1. I am using this for local development", ""}, |
| 13 | {"WARNING: Loading development channels Channels: server:cage ❯ 1. I am using this for local development", "channel"}, |
| 14 | {"Do you want to proceed? 1. Yes 2. No", ""}, |
| 15 | {"New MCP server found in this project: other Use this MCP server", ""}, |
| 16 | {"Do you want to use this API key?", ""}, |
| 17 | } { |
| 18 | if got := cliStartupDialog(cliStartupText([]byte(tc.text)), "/work/project"); got != tc.want { |
| 19 | t.Errorf("dialog %q: %q, want %q", tc.text, got, tc.want) |
| 20 | } |
| 21 | } |
| 22 | } |