test(daemon): cover coordinator session handoffs
- commit
- a4184b2ad9231fa36dc2f7ee6c69ea691c279319
- author
- brice · · 2026-07-11 16:29 UTC
- parent
- ac3765a
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +21 -0
M internal/usecase/daemon/render_coordinator_test.go +21 -0
| @@ -312,6 +312,27 @@ func TestRenderCoordinatorPreviewSubscription(t *testing.T) { | |||
| 312 | 312 | ||
| 313 | 313 | // --- lifecycle and stale callbacks ----------------------------------------------- | |
| 314 | 314 | ||
| 315 | + | func TestRenderCoordinatorPreviewSubscriptionsAreIndependent(t *testing.T) { | |
| 316 | + | h := newCoordinatorHarness(t) | |
| 317 | + | one, two := &attachedClient{}, &attachedClient{} | |
| 318 | + | first, second := make(chan renderWake, 1), make(chan renderWake, 1) | |
| 319 | + | h.rc.subscribePreviewFor(one, func(w renderWake) { first <- w }) | |
| 320 | + | h.rc.subscribePreviewFor(two, func(w renderWake) { second <- w }) | |
| 321 | + | h.rc.attach(&attachedClient{}) | |
| 322 | + | h.rc.invalidate(renderInvalidation{class: invalidateOutput, producer: "preview"}) | |
| 323 | + | last := h.armedTimers(t) | |
| 324 | + | last[len(last)-1].ch <- time.Time{} | |
| 325 | + | awaitWake(t, first) | |
| 326 | + | awaitWake(t, second) | |
| 327 | + | ||
| 328 | + | h.rc.teardownPreviewFor(one) | |
| 329 | + | h.rc.invalidate(renderInvalidation{class: invalidateOutput, producer: "preview"}) | |
| 330 | + | last = h.armedTimers(t) | |
| 331 | + | last[len(last)-1].ch <- time.Time{} | |
| 332 | + | requireNoWake(t, first) | |
| 333 | + | awaitWake(t, second) | |
| 334 | + | } | |
| 335 | + | ||
| 315 | 336 | func TestRenderCoordinatorLifecycleDropsStaleWakes(t *testing.T) { | |
| 316 | 337 | cases := []struct { | |
| 317 | 338 | name string | |
| @@ -312,6 +312,27 @@ func TestRenderCoordinatorPreviewSubscription(t *testing.T) { | |||||
| 312 | 312 | ||||
| 313 | // --- lifecycle and stale callbacks ----------------------------------------------- | 313 | // --- lifecycle and stale callbacks ----------------------------------------------- | ||
| 314 | 314 | ||||
| 315 | + | func TestRenderCoordinatorPreviewSubscriptionsAreIndependent(t *testing.T) { | |||
| 316 | + | h := newCoordinatorHarness(t) | |||
| 317 | + | one, two := &attachedClient{}, &attachedClient{} | |||
| 318 | + | first, second := make(chan renderWake, 1), make(chan renderWake, 1) | |||
| 319 | + | h.rc.subscribePreviewFor(one, func(w renderWake) { first <- w }) | |||
| 320 | + | h.rc.subscribePreviewFor(two, func(w renderWake) { second <- w }) | |||
| 321 | + | h.rc.attach(&attachedClient{}) | |||
| 322 | + | h.rc.invalidate(renderInvalidation{class: invalidateOutput, producer: "preview"}) | |||
| 323 | + | last := h.armedTimers(t) | |||
| 324 | + | last[len(last)-1].ch <- time.Time{} | |||
| 325 | + | awaitWake(t, first) | |||
| 326 | + | awaitWake(t, second) | |||
| 327 | + | ||||
| 328 | + | h.rc.teardownPreviewFor(one) | |||
| 329 | + | h.rc.invalidate(renderInvalidation{class: invalidateOutput, producer: "preview"}) | |||
| 330 | + | last = h.armedTimers(t) | |||
| 331 | + | last[len(last)-1].ch <- time.Time{} | |||
| 332 | + | requireNoWake(t, first) | |||
| 333 | + | awaitWake(t, second) | |||
| 334 | + | } | |||
| 335 | + | ||||
| 315 | func TestRenderCoordinatorLifecycleDropsStaleWakes(t *testing.T) { | 336 | func TestRenderCoordinatorLifecycleDropsStaleWakes(t *testing.T) { | ||
| 316 | cases := []struct { | 337 | cases := []struct { | ||
| 317 | name string | 338 | name string | ||