Add Prettier and ESLint tooling (Refs #77)

This commit is contained in:
2026-10-09 15:56:13 -04:00
parent 8ed059b8d3
commit 16469e2d43
711 changed files with 99737 additions and 28286 deletions
+20 -3
View File
@@ -9,13 +9,25 @@ it('keeps healthy reports online across polling and delivery delays, then expire
vi.useFakeTimers();
const reportAt = Date.parse('2026-09-18T12:00:00Z');
const timestamp = new Date(reportAt).toISOString();
for (const elapsed of [-999, 0, STATUS_REFRESH_MS, STATUS_REFRESH_MS + 4000, 45_000, 60_000, 90_000, 90_001, 120_000]) {
for (const elapsed of [
-999,
0,
STATUS_REFRESH_MS,
STATUS_REFRESH_MS + 4000,
45_000,
60_000,
90_000,
90_001,
120_000
]) {
const now = reportAt + elapsed;
vi.setSystemTime(now);
const expected = elapsed <= 90_000;
const health = classifyHealth(timestamp, null, 'running');
expect(health).toBe(expected ? 'online' : 'stale');
expect(freshServer({ health, last_seen_at: timestamp, last_error: null } as FleetServer, now)).toBe(expected);
expect(
freshServer({ health, last_seen_at: timestamp, last_error: null } as FleetServer, now)
).toBe(expected);
}
vi.setSystemTime(reportAt + 120_001);
expect(classifyHealth(timestamp, null, 'running')).toBe('offline');
@@ -29,7 +41,12 @@ it('does not hide failures or accept missing, invalid, or far-future timestamps'
expect(classifyHealth(timestamp, 'timeout', 'running')).toBe('stale');
expect(classifyHealth(timestamp, null, 'stopped')).toBe('offline');
expect(classifyHealth(timestamp, null, 'restarting')).toBe('starting');
expect(freshServer({ health: 'online', last_seen_at: timestamp, last_error: 'timeout' } as FleetServer, now)).toBe(false);
expect(
freshServer(
{ health: 'online', last_seen_at: timestamp, last_error: 'timeout' } as FleetServer,
now
)
).toBe(false);
for (const invalid of [null, 'invalid', new Date(now + 1001).toISOString()]) {
expect(freshStatusTimestamp(invalid, now)).toBe(false);
expect(classifyHealth(invalid, null, 'running')).toBe('offline');