Files
cinny/src/app/utils/deafenCatchUp.test.ts
T
jaredandClaude Opus 5 33e16e85b3
CI / Build & Quality Checks (push) Successful in 1m59s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 15s
CI / Trigger Desktop Build (push) Successful in 12s
CI / Playwright smoke (e2e) (push) Successful in 2m23s
feat(calls): undeafen catch-up toast (#128)
On deafen the participant set is snapshotted; on undeafen it is diffed and,
only if it changed and you were deafened for at least 10 s, one auto-dismissing
toast says 'While you were deafened: Alice, Bob joined · Cole left' (names
capped at 3 + N more). Rides the membership stream that already drives the
join/leave sounds — no new subscriptions; PTT holds don't touch deafen so they
can't trigger it. Verified headless: short deafen → nothing; bob leaves during
an 11 s deafen → 'bob left'; long deafen with no change → nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
2026-09-19 17:17:58 -04:00

18 lines
689 B
TypeScript

import { test } from 'node:test';
import assert from 'node:assert/strict';
import { deafenCatchUpText } from './deafenCatchUp';
const name = (u: string) => u.slice(1, u.indexOf(':'));
test('no change → nothing; joins and leaves are listed, capped at 3 + N more', () => {
assert.equal(deafenCatchUpText(new Set(['@a:x']), new Set(['@a:x']), name), null);
assert.equal(
deafenCatchUpText(new Set(['@a:x', '@c:x']), new Set(['@a:x', '@b:x']), name),
'While you were deafened: b joined · c left',
);
assert.equal(
deafenCatchUpText(new Set(), new Set(['@a:x', '@b:x', '@c:x', '@d:x', '@e:x']), name),
'While you were deafened: a, b, c and 2 more joined',
);
});