Simplify telemetry to three game events

This commit is contained in:
2026-09-18 15:35:21 -04:00
parent 6d903adb31
commit 5bb49a776e
29 changed files with 658 additions and 1314 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { currentRound, fleetIdentity, matchesFleet, watchSatisfied, type FleetServer, type FleetOperation } from '../../src/lib/fleet-overview.js';
import { gameEvent } from '../helpers/telemetry.js';
import { newFixture, type Fixture } from '../helpers/fixture.js';
const now = Date.parse('2026-09-18T12:00:00Z');
@@ -42,7 +43,7 @@ describe('Fleet discovery and match freshness', () => {
expect(matchesFleet({ ...server, health: 'starting' }, '', 'attention', '', [], [], now)).toBe(false);
});
it('only spotlights fresh telemetry from the current occupied match', () => {
const report = { server: server.name, round: 38, players: 4, receivedAt: iso(-1000) };
const report = { ...gameEvent('round_change', 38, 4, server.name), receivedAt: iso(-1000) };
expect(currentRound(server, report, now)).toBe(38);
for (const change of [{ receivedAt: iso(-121_000) }, { receivedAt: iso(-61_000) }, { receivedAt: iso(60_000) }]) {
expect(currentRound(server, { ...report, ...change }, now)).toBeNull();