Analyse: Messdienst: Heatmap-Pfad wie gespeicherter Pfad, Tests für Kodierung und Stunde

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-01 18:50:26 +00:00
1 parent 96409c6306
commit a73e0be952
4 files changed
+35 -3

No files matched your search

+24
View File
@@ -425,3 +425,27 @@ test('T14: kennungsartige Pfadsegmente werden zu :id, alle Typen', async () => {
assert.equal(t.db.prepare('SELECT path FROM clicks').get().path, '/kunde/:id');
t.close();
});
test('T14: ungültige Prozent-Kodierung fällt auf den Rohwert zurück', async () => {
const t = await setup();
await t.post(pv({ path: '/a/%E0%A4%A/123456' }));
await t.post(pv({ path: '/a/%E0%A4%A/x' }));
await t.post(pv({ path: '/a/%E0%A4%A40/x' }));
assert.deepEqual(t.rows().map((r) => r.path), ['/a/%E0%A4%A/:id', '/a/%E0%A4%A/x', '/a/%E0%A4%A40/x']);
t.close();
});
test('T3: jede gespeicherte Zeile jedes Typs liegt auf der vollen Stunde (ungerade Uhrzeit)', async () => {
const t = await setup({ now: () => Date.UTC(2026, 9, 1, 10, 37, 12, 345) });
await t.post({ t: 'bn', site: KEY, a: 'shown' });
await t.post(pv());
await t.post({ t: 'cx', site: KEY, path: '/', vp: 'd' });
await t.post({ t: 'en', site: KEY, path: '/', vp: 'd', sec: 5, scroll: 10 });
await t.post({ t: 'ct', site: KEY, path: '/', kind: 'tel' });
await t.post({ t: 'ck', site: KEY, path: '/', vp: 'd', x: 0.5, y: 0.5 });
const r = t.rows();
assert.deepEqual([...new Set(r.map((x) => x.type))].sort(), ['bn', 'ct', 'cx', 'en', 'pv']);
for (const x of r) assert.equal(x.ts % 3600000, 0);
for (const x of t.db.prepare('SELECT ts FROM clicks').all()) assert.equal(x.ts % 3600000, 0);
t.close();
});