MCPcopy Create free account
hub / github.com/diillson/chatcli / TestAnimation_NoSpinnerOffTerminal

Function TestAnimation_NoSpinnerOffTerminal

cli/animation_manager_test.go:18–35  ·  view source on GitHub ↗

TestAnimation_NoSpinnerOffTerminal verifies the production behavior that the thinking spinner does not start when stdout is not a terminal (pipe/CI): the message is recorded but no goroutine repaints into the stream.

(t *testing.T)

Source from the content-addressed store, hash-verified

16// thinking spinner does not start when stdout is not a terminal (pipe/CI):
17// the message is recorded but no goroutine repaints into the stream.
18func TestAnimation_NoSpinnerOffTerminal(t *testing.T) {
19 t.Cleanup(func() { theme.SetProfile(theme.DetectProfile()) })
20 theme.SetProfile(theme.ProfileNoTTY)
21
22 am := NewAnimationManager()
23 am.ShowThinkingAnimation("pensando")
24
25 am.mu.Lock()
26 running := am.isRunning
27 msg := am.currentMessage
28 am.mu.Unlock()
29
30 assert.False(t, running, "no spinner goroutine off-terminal")
31 assert.Equal(t, "pensando", msg, "message is still recorded for non-animated surfaces")
32
33 // Stop must be a safe no-op when nothing started.
34 am.StopThinkingAnimation()
35}
36
37// TestAnimation_SuppressedDoesNotRun confirms explicit suppression (used by
38// the unattended gateway) also prevents the goroutine even on a terminal.

Callers

nothing calls this directly

Calls 9

ShowThinkingAnimationMethod · 0.95
StopThinkingAnimationMethod · 0.95
SetProfileFunction · 0.92
DetectProfileFunction · 0.92
NewAnimationManagerFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
EqualMethod · 0.80
CleanupMethod · 0.45

Tested by

no test coverage detected