MCPcopy Create free account
hub / github.com/diillson/chatcli / TestHandleProviderCommand

Function TestHandleProviderCommand

cli/provider_command_test.go:71–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func 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
90func TestCommandIsPickable(t *testing.T) {
91 cli := newProviderTestCLI("OPENAI", []string{"OPENAI", "CLAUDEAI"})

Callers

nothing calls this directly

Calls 3

newProviderTestCLIFunction · 0.85
handleProviderCommandMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected