AI Implementation feature(905): Challenges Page and Challenge Solve Modal 1.01 (#47)

This commit was merged in pull request #47.
This commit is contained in:
2026-07-23 01:20:00 +00:00
parent 1bd4a5a198
commit cbfa9c35ca
9 changed files with 437 additions and 115 deletions
+20
View File
@@ -183,6 +183,26 @@ describe('ChallengesPage (gate + countdown + auto-reload wiring)', () => {
expect(handler).toHaveBeenCalledTimes(2);
});
it('repeating the same zero-countdown SSE frame does not disarm the auto-reload latch (Job 905)', () => {
const handler = jest.fn();
eventStore.reloadAtCountdownZero(handler);
const frame = {
state: 'countdown' as const,
serverNowUtc: new Date().toISOString(),
eventStartUtc: new Date(Date.now() - 1000).toISOString(),
eventEndUtc: new Date(Date.now() + 7200_000).toISOString(),
secondsToStart: 0,
secondsToEnd: null,
};
eventStore.applyServerStatus(frame);
eventStore.applyServerStatus(frame);
eventStore.applyServerStatus(frame);
(eventStore as any).checkZero();
expect(handler).toHaveBeenCalledTimes(1);
});
it('isRunning flips true only when state is running', async () => {
apiSpy.getBoard.mockReturnValueOnce(of(makeBoard()));
await challenges.load();