fix(call-to-play): extend from the current deadline
Pass the effective nomination deadline into the Add time action and extend from whichever is later: that deadline or the current time. This preserves remaining time when a call becomes ready early while still giving an overdue call a fresh five-minute window. Test Plan: - just fmt - just frontend-test - just build - git diff --cached --check
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
EXPIRED_RETENTION_MS,
|
||||
TERMINAL_RETENTION_MS,
|
||||
activeCallCount,
|
||||
extendDeadline,
|
||||
phaseOf,
|
||||
bumpTime,
|
||||
normalizeTimeInput,
|
||||
@@ -163,6 +164,20 @@ Deno.test('creator can extend, start, and cancel a call', () => {
|
||||
assertEquals(cancelled.terminalAt, NOW + 1, 'cancel timestamp');
|
||||
});
|
||||
|
||||
Deno.test('adding time extends from the current deadline or the current time', () => {
|
||||
const futureDeadline = NOW + 30 * 60_000;
|
||||
assertEquals(
|
||||
extendDeadline(NOW, futureDeadline),
|
||||
futureDeadline + 5 * 60_000,
|
||||
'ready-early call keeps its remaining time',
|
||||
);
|
||||
assertEquals(
|
||||
extendDeadline(NOW, NOW - 60_000),
|
||||
NOW + 5 * 60_000,
|
||||
'overdue call gets five minutes from now',
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test('reduction is order-independent and deduplicates events and messages', () => {
|
||||
const message = event('message-event', 'Bob', {
|
||||
SendMessage: { message_id: 'message-1', text: 'Ready?' },
|
||||
|
||||
Reference in New Issue
Block a user