MCPcopy Index your code
hub / github.com/coder/coder / TestExpChatContextAdd

Function TestExpChatContextAdd

cli/exp_chat_test.go:11–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestExpChatContextAdd(t *testing.T) {
12 t.Parallel()
13
14 t.Run("RequiresWorkspaceOrDir", func(t *testing.T) {
15 t.Parallel()
16
17 inv, _ := clitest.New(t, "exp", "chat", "context", "add")
18
19 err := inv.Run()
20 require.Error(t, err)
21 require.Contains(t, err.Error(), "this command must be run inside a Coder workspace")
22 })
23
24 t.Run("AllowsExplicitDir", func(t *testing.T) {
25 t.Parallel()
26
27 inv, _ := clitest.New(t, "exp", "chat", "context", "add", "--dir", t.TempDir())
28
29 err := inv.Run()
30 if err != nil {
31 require.NotContains(t, err.Error(), "this command must be run inside a Coder workspace")
32 }
33 })
34
35 t.Run("AllowsWorkspaceEnv", func(t *testing.T) {
36 t.Parallel()
37
38 inv, _ := clitest.New(t, "exp", "chat", "context", "add")
39 inv.Environ.Set("CODER", "true")
40
41 err := inv.Run()
42 if err != nil {
43 require.NotContains(t, err.Error(), "this command must be run inside a Coder workspace")
44 }
45 })
46}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
RunMethod · 0.65
TempDirMethod · 0.65
SetMethod · 0.65
ErrorMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected