(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestHandleProviderCommand(t *testing.T) { |
| 72 | t.Setenv("HOME", t.TempDir()) // isolate the runtime-model state file write |
| 73 | |
| 74 | cli := newProviderTestCLI("OPENAI", []string{"OPENAI", "CLAUDEAI"}) |
| 75 | |
| 76 | cli.handleProviderCommand(context.Background(), "/provider claudeai") // case-insensitive switch |
| 77 | if cli.Provider != "CLAUDEAI" { |
| 78 | t.Fatalf("provider = %q, want CLAUDEAI", cli.Provider) |
| 79 | } |
| 80 | cli.handleProviderCommand(context.Background(), "/provider NOPE") // unknown → unchanged |
| 81 | if cli.Provider != "CLAUDEAI" { |
| 82 | t.Errorf("unknown provider changed it to %q", cli.Provider) |
| 83 | } |
| 84 | cli.handleProviderCommand(context.Background(), "/provider") // bare lists, leaves it unchanged |
| 85 | if cli.Provider != "CLAUDEAI" { |
| 86 | t.Errorf("bare /provider changed it to %q", cli.Provider) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | func TestCommandIsPickable(t *testing.T) { |
| 91 | cli := newProviderTestCLI("OPENAI", []string{"OPENAI", "CLAUDEAI"}) |
nothing calls this directly
no test coverage detected