(t *testing.T)
| 173 | } |
| 174 | |
| 175 | func TestHandleHook_AppIDEncodedInURL(t *testing.T) { |
| 176 | prev := resolveAppID |
| 177 | t.Cleanup(func() { resolveAppID = prev }) |
| 178 | resolveAppID = func(context.Context, map[string]string) string { return "myapp" } |
| 179 | |
| 180 | t.Setenv("NO_COLOR", "1") // emit a plain URL we can substring-match |
| 181 | for _, rootCmd := range []string{"compose logs", "compose up"} { |
| 182 | t.Run(rootCmd, func(t *testing.T) { |
| 183 | data := marshalHookData(t, hooks.Request{ |
| 184 | RootCmd: rootCmd, |
| 185 | Flags: map[string]string{"d": "true"}, |
| 186 | }) |
| 187 | var buf bytes.Buffer |
| 188 | err := handleHook(t.Context(), []string{data}, &buf) |
| 189 | assert.NilError(t, err) |
| 190 | |
| 191 | msg := unmarshalResponse(t, buf.Bytes()) |
| 192 | assert.Assert(t, strings.Contains(msg.Template, desktop.BuildLogsURL("myapp")), |
| 193 | "hint should include the project-scoped URL, got %q", msg.Template) |
| 194 | }) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | func TestHandleHook_DockerLogsIgnoresAppID(t *testing.T) { |
| 199 | // resolveAppID is not consulted for "logs" because that hint isn't |
nothing calls this directly
no test coverage detected