feat(web): phase-aware dm_call_undeliverable toast copy (TDD)

This commit is contained in:
Jannis Braun
2026-04-23 23:21:40 +02:00
parent f6252b8ce1
commit 6a5b02b1a0
3 changed files with 104 additions and 34 deletions
@@ -0,0 +1,37 @@
import { describe, it, expect } from 'vitest';
import { buildCallUndeliverableToast } from '../../utils/callUndeliverableToast.js';
describe('buildCallUndeliverableToast', () => {
const fail = (overrides: Partial<{ reason: string; peerOrigin?: string; peerLabel?: string }> = {}) => ({
reason: 'peer_transient_failure',
peerLabel: 'nova',
...overrides,
});
it('start + terminal single failure: existing copy', () => {
expect(buildCallUndeliverableToast([fail()], true, 'start')).toMatch(/Could not reach nova/);
});
it('start + non-terminal: "some participants" copy', () => {
expect(buildCallUndeliverableToast([fail()], false, 'start')).toMatch(/Some participants could not be reached/);
});
it('accept + terminal: tear-down copy', () => {
expect(buildCallUndeliverableToast([fail()], true, 'accept'))
.toMatch(/Couldn't confirm your accept with nova/);
});
it('reject + non-terminal: info copy', () => {
expect(buildCallUndeliverableToast([fail()], false, 'reject'))
.toMatch(/Couldn't notify nova that you declined/);
});
it('end + non-terminal: info copy', () => {
expect(buildCallUndeliverableToast([fail()], false, 'end'))
.toMatch(/Couldn't notify nova that you hung up/);
});
it('legacy two-arg signature still works', () => {
expect(buildCallUndeliverableToast([fail()], true)).toMatch(/Could not reach nova/);
});
});