forked from coder/agentapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_test.go
More file actions
85 lines (80 loc) · 1.6 KB
/
server_test.go
File metadata and controls
85 lines (80 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package server
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestParseAgentType(t *testing.T) {
tests := []struct {
firstArg string
agentTypeVar string
want AgentType
}{
{
firstArg: "",
agentTypeVar: "",
want: AgentTypeCustom,
},
{
firstArg: "claude",
agentTypeVar: "",
want: AgentTypeClaude,
},
{
firstArg: "gemini",
agentTypeVar: "",
want: AgentTypeGemini,
},
{
firstArg: "goose",
agentTypeVar: "",
want: AgentTypeGoose,
},
{
firstArg: "aider",
agentTypeVar: "",
want: AgentTypeAider,
},
{
firstArg: "whatever",
agentTypeVar: "",
want: AgentTypeCustom,
},
{
firstArg: "claude",
agentTypeVar: "goose",
want: AgentTypeGoose,
},
{
firstArg: "goose",
agentTypeVar: "claude",
want: AgentTypeClaude,
},
{
firstArg: "claude",
agentTypeVar: "gemini",
want: AgentTypeGemini,
},
{
firstArg: "aider",
agentTypeVar: "claude",
want: AgentTypeClaude,
},
{
firstArg: "aider",
agentTypeVar: "custom",
want: AgentTypeCustom,
},
}
for _, test := range tests {
t.Run(fmt.Sprintf("%s-%s-%s", test.firstArg, test.agentTypeVar, test.want), func(t *testing.T) {
got, err := parseAgentType(test.firstArg, test.agentTypeVar)
require.NoError(t, err)
require.Equal(t, test.want, got)
})
}
t.Run("invalid agent type", func(t *testing.T) {
_, err := parseAgentType("claude", "invalid")
require.Error(t, err)
})
}