feat(speedtest): results table + repo
This commit is contained in:
15
tests/repos/speedtest.test.js
Normal file
15
tests/repos/speedtest.test.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { describe, it, expect, beforeAll } from 'vitest';
|
||||
import { resetDb } from '../helpers/db.js';
|
||||
import { migrateUp } from '../../lib/db/migrate.js';
|
||||
import * as repo from '../../lib/db/repos/speedtest.js';
|
||||
|
||||
beforeAll(async () => { await resetDb(); await migrateUp(); });
|
||||
describe('speedtest repo', () => {
|
||||
it('records and lists newest-first', async () => {
|
||||
await repo.record({ down_mbps: 100, up_mbps: 20, ping_ms: 8 });
|
||||
await repo.record({ down_mbps: 110, up_mbps: 22, ping_ms: 7 });
|
||||
const hist = await repo.history(30);
|
||||
expect(hist.length).toBe(2);
|
||||
expect(Number(hist[0].down_mbps)).toBe(110); // newest first
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user