-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathopen_test.go
More file actions
45 lines (41 loc) · 968 Bytes
/
open_test.go
File metadata and controls
45 lines (41 loc) · 968 Bytes
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
package open
import (
"testing"
)
func TestIsEditorType(t *testing.T) {
valid := []string{"code", "cursor", "windsurf", "terminal", "tmux", "claude", "codex"}
for _, v := range valid {
if !isEditorType(v) {
t.Errorf("expected %q to be valid editor type", v)
}
}
invalid := []string{"vim", "emacs", "vscode", "Code", "", "ssh"}
for _, v := range invalid {
if isEditorType(v) {
t.Errorf("expected %q to NOT be valid editor type", v)
}
}
}
func TestGetEditorName(t *testing.T) {
tests := []struct {
input string
want string
}{
{"code", "VSCode"},
{"cursor", "Cursor"},
{"windsurf", "Windsurf"},
{"terminal", "Terminal"},
{"tmux", "tmux"},
{"claude", "Claude Code"},
{"codex", "Codex"},
{"unknown", "VSCode"},
}
for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) {
got := getEditorName(tt.input)
if got != tt.want {
t.Errorf("getEditorName(%q) = %q, want %q", tt.input, got, tt.want)
}
})
}
}