MCPcopy
hub / github.com/docker/compose / TestBuildLogsURL

Function TestBuildLogsURL

internal/desktop/client_test.go:28–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestBuildLogsURL(t *testing.T) {
29 tests := []struct {
30 name string
31 appID string
32 want string
33 }{
34 {
35 name: "empty app id yields paramless url",
36 appID: "",
37 want: "docker-desktop://dashboard/logs",
38 },
39 {
40 name: "simple project name",
41 appID: "myapp",
42 want: "docker-desktop://dashboard/logs?appId=myapp",
43 },
44 {
45 name: "name with hyphen and digits is preserved",
46 appID: "my-app-2",
47 want: "docker-desktop://dashboard/logs?appId=my-app-2",
48 },
49 {
50 name: "characters that need percent-encoding are escaped",
51 appID: "weird name/with spaces",
52 want: "docker-desktop://dashboard/logs?appId=weird+name%2Fwith+spaces",
53 },
54 }
55 for _, tt := range tests {
56 t.Run(tt.name, func(t *testing.T) {
57 assert.Equal(t, BuildLogsURL(tt.appID), tt.want)
58 })
59 }
60}
61
62func TestBuildLogsURL_TruncatesLongAppID(t *testing.T) {
63 long := strings.Repeat("a", LogsAppIDMaxLen+50)

Callers

nothing calls this directly

Calls 1

BuildLogsURLFunction · 0.85

Tested by

no test coverage detected