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

Function TestHandleHook_HintContainsOSC8Link

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

Source from the content-addressed store, hash-verified

140}
141
142func TestHandleHook_HintContainsOSC8Link(t *testing.T) {
143 // Ensure ANSI is not suppressed by the test runner environment
144 t.Setenv("NO_COLOR", "")
145 t.Setenv("COMPOSE_ANSI", "")
146 data := marshalHookData(t, hooks.Request{
147 RootCmd: "compose logs",
148 })
149 var buf bytes.Buffer
150 err := handleHook(t.Context(), []string{data}, &buf)
151 assert.NilError(t, err)
152
153 msg := unmarshalResponse(t, buf.Bytes())
154 // Verify the template contains the OSC 8 hyperlink sequence
155 wantLink := formatter.OSC8Link(testDeepLink, testDeepLink)
156 assert.Assert(t, len(wantLink) > len(testDeepLink), "OSC8Link should wrap the URL with escape sequences")
157 assert.Assert(t, strings.Contains(msg.Template, wantLink), "hint should contain OSC 8 hyperlink")
158}
159
160func TestHandleHook_NoColorDisablesOsc8(t *testing.T) {
161 t.Setenv("NO_COLOR", "1")

Callers

nothing calls this directly

Calls 5

OSC8LinkFunction · 0.92
marshalHookDataFunction · 0.85
handleHookFunction · 0.85
unmarshalResponseFunction · 0.85
BytesMethod · 0.80

Tested by

no test coverage detected