(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func 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 | |
| 62 | func TestBuildLogsURL_TruncatesLongAppID(t *testing.T) { |
| 63 | long := strings.Repeat("a", LogsAppIDMaxLen+50) |
nothing calls this directly
no test coverage detected