kimai-plugin-heatmap/.planning/milestones/v1.0-phases/05-polish/05-02-PLAN.md
Christopher Mühl 244c7c66fc
chore: archive v1.0 milestone
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 23:25:26 +02:00

1.3 KiB

Plan 05-02: Tests for Polish Features

Phase: 5 — Polish Requirements: POLI-01, POLI-02, POLI-03 (test coverage) Estimated tasks: 3

Goal

Add Vitest tests for streak calculation, summary stats, weekend styling, and week start configurability.

Tasks

Task 1: Streak calculation tests

File: assets/test/stats.test.ts (new) Tests:

  • Streak of 3 consecutive days ending today → returns 3
  • Gap in the middle breaks streak → returns days after gap
  • No entries today but entries yesterday → streak counts from yesterday
  • No entries at all → returns 0
  • Single day entry (today) → returns 1

Task 2: Summary stats tests

File: assets/test/stats.test.ts (same file) Tests:

  • Total hours sums correctly
  • Average hours divides by days-with-entries (not total calendar days)
  • Busiest day picks the max-hours entry
  • Empty data returns zeroes and null busiest day

Task 3: Weekend and week start rendering tests

File: assets/test/heatmap.test.ts (extend existing) Tests:

  • Weekend cells (Sat/Sun) have heatmap-weekend class
  • Weekday cells do NOT have heatmap-weekend class
  • Stats row renders below heatmap with streak and stat values

Verification

  • npm test passes all new and existing tests

Commit

test: add tests for streak, stats, weekend styling