Skip to content

Commit d65366a

Browse files
committed
test(tui): drop racy tick-cmd assertion from slack subscription test
TestBottomSlackAnimationSubscribesWhileDecaying was flaky when run in parallel with other tests touching the animation coordinator. animation.Subscription.Start only returns a non-nil tea.Cmd for the first global subscriber: subsequent subscribers piggy-back on the already-running tick stream. So when other parallel tests had already registered an animation, our Start returned nil even though our subscription was correctly registered, and the assert.NotNil(t, cmd, ...) addition from the previous commit failed roughly 1 in 5 runs. The local IsActive() assertion is sufficient to verify that handleAnimationTick registered the subscription. Asserting on the global tick command is racy without exposing test-only resets in the animation package, which isn't worth it. Verified stable across 20 -race iterations. Assisted-By: docker-agent
1 parent 19bf5d8 commit d65366a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

pkg/tui/components/messages/slack_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ func TestBottomSlackAnimationSubscribesWhileDecaying(t *testing.T) {
111111
"no slack means no animation subscription")
112112

113113
// Slack > 0: a tick should subscribe so further ticks keep firing
114-
// even after fade animations finish, and Update must return the
115-
// scheduling command so Bubbletea actually delivers the next tick.
114+
// even after fade animations finish. We can only assert on the local
115+
// subscription state — the global tick command from Subscription.Start
116+
// is non-nil only for the first global subscriber, which is racy when
117+
// tests touching the animation coordinator run in parallel.
116118
m.bottomSlack = 2
117-
_, cmd := m.Update(animation.TickMsg{Frame: 1})
119+
m.Update(animation.TickMsg{Frame: 1})
118120
assert.True(t, m.slackAnimationSub.IsActive(),
119121
"subscription should be active while slack > 0")
120-
assert.NotNil(t, cmd,
121-
"Update must return a tick command so the next tick is scheduled")
122122

123123
// Once slack hits zero, the subscription must release the global tick.
124124
m.Update(animation.TickMsg{Frame: 2})

0 commit comments

Comments
 (0)