Repository navigation
Expand file tree
/
Copy pathdockerfile_test.go
More file actions
97 lines (84 loc) · 2.12 KB
/
Copy pathdockerfile_test.go
File metadata and controls
97 lines (84 loc) · 2.12 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
86
87
88
89
90
91
92
93
94
95
96
97
package main
import (
"strings"
"testing"
)
func TestDockerfile(t *testing.T) {
for _, tool := range supportedTools {
t.Run(tool.Name, func(t *testing.T) {
df := Dockerfile(tool)
if df == "" {
t.Error("expected dockerfile to not be empty")
}
// Check for base stage
if !strings.Contains(df, "FROM ubuntu:24.04 AS base") {
t.Error("expected dockerfile to contain base stage")
}
// Check that it contains only this tool's stage
if !strings.Contains(df, "FROM base AS "+tool.Name) {
t.Errorf("expected dockerfile to contain %s stage", tool.Name)
}
// Check for build args
if !strings.Contains(df, "ARG USER") {
t.Error("expected dockerfile to contain USER build arg")
}
if !strings.Contains(df, "ARG UID") {
t.Error("expected dockerfile to contain UID build arg")
}
if !strings.Contains(df, "ARG HOME") {
t.Error("expected dockerfile to contain HOME build arg")
}
})
}
}
func TestAvailableTools(t *testing.T) {
tools := AvailableTools(supportedTools)
if len(tools) == 0 {
t.Fatal("expected at least one tool")
}
expected := map[string]bool{
"claude": true,
"cline": true,
"codex": true,
"opencode": true,
"paperclipai": true,
"copilot": true,
"vibe": true,
"kilo": true,
"pi": true,
}
for _, tool := range tools {
if !expected[tool] {
t.Errorf("unexpected tool: %s", tool)
}
delete(expected, tool)
}
for tool := range expected {
t.Errorf("missing expected tool: %s", tool)
}
}
func TestToolDescription(t *testing.T) {
tests := []struct {
tool string
contains string
}{
{"claude", "Claude"},
{"cline", "Cline"},
{"codex", "Codex"},
{"opencode", "OpenCode"},
{"paperclipai", "Paperclip"},
{"copilot", "Copilot"},
{"vibe", "Vibe"},
{"kilo", "Kilo"},
{"pi", "Pi"},
{"unknown", "Unknown"},
}
for _, tt := range tests {
t.Run(tt.tool, func(t *testing.T) {
desc := ToolDescription(supportedTools, tt.tool)
if !strings.Contains(desc, tt.contains) {
t.Errorf("expected description for %s to contain %q, got %q", tt.tool, tt.contains, desc)
}
})
}
}