test: state-machine tests for watchVideoTrackForRemoval
15 unit + integration tests that extract the function and the shipped VIDEO_REMOVE_MUTE_WINDOW_MS constant from web/zebra-spaces.html so the assertions track exactly what's deployed. Drives synthetic mute/ unmute/ended event sequences against a fake EventTarget track with a fake clock injected through a Function-constructor harness. Unit coverage: - shipped window must be >= 10s (catches accidental shorten) - initial mute (never flowed) never removes - flowing + sustained mute past window removes - mute + unmute within window cancels removal - ended event removes immediately + cancels pending timer - removeFn is idempotent (no double-call across mute, ended, or later events) - redundant mute events do not stack timers - rescue and removal both emit logLine telemetry - rapid mute/unmute oscillation never removes while unmute lands in time Integration coverage (realistic lifecycles): - fresh track -> flow -> publisher unshares -> tile removed - mobile network handoff (long mute) recovers without removal - peer leaves abruptly (ended fires) -> tile removed once - hard refresh of publisher (SFU supplant renegotiation gap) -> tile survives — this is the cascade fox flagged where a phone reconnect was killing the host's view of its camera - publisher process crashes (mute holds indefinitely) -> removed at window Wired into Makefile as test-video-removal + added to test-all. Pure Node, no browser or proxy server needed.
This commit is contained in:
parent
bb1bf56527
commit
9419a415bf
2 changed files with 339 additions and 1 deletions
13
Makefile
13
Makefile
|
|
@ -25,6 +25,15 @@ test-web:
|
|||
test-fsm:
|
||||
@node test/zebra-fsm.test.js
|
||||
|
||||
# Receive-side stream lifecycle (watchVideoTrackForRemoval) — fake-clock
|
||||
# state-machine tests covering 'when is it safe to remove a tile'. Catches
|
||||
# the regressions where transient mutes (NACK gaps, network blips, mobile
|
||||
# handoffs, hard-refresh renegotiation churn) would otherwise kill live
|
||||
# tiles. Extracts the function from the page and the shipped mute window
|
||||
# so the assertions track what's live.
|
||||
test-video-removal:
|
||||
@node test/video-track-removal.test.js
|
||||
|
||||
# zebra-spaces JS↔Go protocol parity + vault + ed25519 + (optionally) a live
|
||||
# server flow. The live-server tier auto-runs when proxy.unturf.com sits
|
||||
# alongside this checkout AND has a Go toolchain — we build the relay binary
|
||||
|
|
@ -42,7 +51,7 @@ test-zebra-spaces:
|
|||
ZEBRA_SPACES_BINARY=$$bin node test/zebra-spaces.test.js; \
|
||||
rc=$$?; rm -f /tmp/zspc-signal-test; exit $$rc
|
||||
|
||||
test-all: test/unit test/integration test/functional test-web test-fsm test-zebra-spaces
|
||||
test-all: test/unit test/integration test/functional test-web test-fsm test-video-removal test-zebra-spaces
|
||||
@echo "--- unit ---"
|
||||
@./test/unit
|
||||
@echo "--- integration ---"
|
||||
|
|
@ -53,6 +62,8 @@ test-all: test/unit test/integration test/functional test-web test-fsm test-zebr
|
|||
@node test/web-protocol.test.js
|
||||
@echo "--- zebra-fsm ---"
|
||||
@node test/zebra-fsm.test.js
|
||||
@echo "--- video-track-removal ---"
|
||||
@node test/video-track-removal.test.js
|
||||
@echo "--- zebra-spaces ---"
|
||||
@$(MAKE) -s test-zebra-spaces
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue