feat: Scoreboard: Ranking, Matrix, Event Log and Score Graph 1.00
This commit is contained in:
@@ -133,6 +133,41 @@ describe('ScoreboardStore', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('propagates challenge name and category abbreviation from SSE solve frame to the Event Log row', () => {
|
||||
const api = new FakeApi();
|
||||
const destroyRef: any = { onDestroy: () => {} };
|
||||
const store = new ScoreboardStore(api as any, destroyRef);
|
||||
void store.loadAll();
|
||||
return new Promise<void>((resolve) => {
|
||||
const source = makeFakeSse((type, fn) => {
|
||||
if (type === 'solve') {
|
||||
setTimeout(() => {
|
||||
fn(new MessageEvent('solve', { data: JSON.stringify({
|
||||
challenge_id: 'c2',
|
||||
challenge_name: 'Hardware Hello',
|
||||
category_abbreviation: 'HW',
|
||||
player_id: 'p3',
|
||||
player_name: 'PlayerC',
|
||||
awarded_points: 115,
|
||||
rank_bonus: 15,
|
||||
awarded_at_utc: '2026-07-23T05:25:37.309Z',
|
||||
position: 1,
|
||||
}) }));
|
||||
setTimeout(() => {
|
||||
const top = store.eventLog()?.[0];
|
||||
expect(top?.challengeName).toBe('Hardware Hello');
|
||||
expect(top?.categoryAbbreviation).toBe('HW');
|
||||
expect(top?.playerName).toBe('PlayerC');
|
||||
expect(top?.awardedPoints).toBe(115);
|
||||
resolve();
|
||||
}, 0);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
store.wireSse(() => source);
|
||||
});
|
||||
});
|
||||
|
||||
it('reset clears all signals and stops SSE', () => {
|
||||
const api = new FakeApi();
|
||||
const destroyRef: any = { onDestroy: () => {} };
|
||||
|
||||
Reference in New Issue
Block a user