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

Function TestSafeAgentName

agent/agentcontainers/api_internal_test.go:11–207  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestSafeAgentName(t *testing.T) {
12 t.Parallel()
13
14 tests := []struct {
15 name string
16 folderName string
17 expected string
18 fallback bool
19 }{
20 // Basic valid names
21 {
22 folderName: "simple",
23 expected: "simple",
24 },
25 {
26 folderName: "with-hyphens",
27 expected: "with-hyphens",
28 },
29 {
30 folderName: "123numbers",
31 expected: "123numbers",
32 },
33 {
34 folderName: "mixed123",
35 expected: "mixed123",
36 },
37
38 // Names that need transformation
39 {
40 folderName: "With_Underscores",
41 expected: "with-underscores",
42 },
43 {
44 folderName: "With Spaces",
45 expected: "with-spaces",
46 },
47 {
48 folderName: "UPPERCASE",
49 expected: "uppercase",
50 },
51 {
52 folderName: "Mixed_Case-Name",
53 expected: "mixed-case-name",
54 },
55
56 // Names with special characters that get replaced
57 {
58 folderName: "special@#$chars",
59 expected: "special-chars",
60 },
61 {
62 folderName: "dots.and.more",
63 expected: "dots-and-more",
64 },
65 {
66 folderName: "multiple___underscores",
67 expected: "multiple-underscores",
68 },

Callers

nothing calls this directly

Calls 4

safeAgentNameFunction · 0.85
MatchMethod · 0.80
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected