bd sync: 2026-01-12 17:07:55
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-12 17:07:55 +01:00
parent 5afa96251b
commit e69c94ad20
55 changed files with 190 additions and 2974 deletions

View File

@@ -1,33 +0,0 @@
import { describe, expect, it } from 'vitest';
import { resolveMaxCount, resolveTimelineHours } from '../lib/analytics';
describe('resolveMaxCount', () => {
it('defaults to 1 for empty input', () => {
expect(resolveMaxCount([])).toBe(1);
});
it('returns the highest count', () => {
expect(resolveMaxCount([2, 5, 3])).toBe(5);
});
it('never returns less than 1', () => {
expect(resolveMaxCount([0])).toBe(1);
});
});
describe('resolveTimelineHours', () => {
it('uses fallback when data is missing', () => {
expect(resolveTimelineHours([], 12)).toBe(12);
});
it('calculates rounded hours from timestamps', () => {
const start = new Date('2024-01-01T10:00:00Z').toISOString();
const end = new Date('2024-01-01T21:00:00Z').toISOString();
expect(resolveTimelineHours([start, end], 12)).toBe(11);
});
it('never returns less than 1', () => {
const start = new Date('2024-01-01T10:00:00Z').toISOString();
expect(resolveTimelineHours([start, start], 12)).toBe(1);
});
});