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

Function TestHandleHook_NoColorDisablesOsc8

cmd/compose/hooks_test.go:160–173  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

158}
159
160func TestHandleHook_NoColorDisablesOsc8(t *testing.T) {
161 t.Setenv("NO_COLOR", "1")
162 data := marshalHookData(t, hooks.Request{
163 RootCmd: "compose logs",
164 })
165 var buf bytes.Buffer
166 err := handleHook(t.Context(), []string{data}, &buf)
167 assert.NilError(t, err)
168
169 msg := unmarshalResponse(t, buf.Bytes())
170 // With NO_COLOR set, the hint should contain the plain URL without escape sequences
171 assert.Assert(t, strings.Contains(msg.Template, testDeepLink), "hint should contain the deep link URL")
172 assert.Assert(t, !strings.Contains(msg.Template, "\033"), "hint should not contain ANSI escape sequences")
173}
174
175func TestHandleHook_AppIDEncodedInURL(t *testing.T) {
176 prev := resolveAppID

Callers

nothing calls this directly

Calls 4

marshalHookDataFunction · 0.85
handleHookFunction · 0.85
unmarshalResponseFunction · 0.85
BytesMethod · 0.80

Tested by

no test coverage detected