mirror of
https://github.com/tiennm99/ghglance.git
synced 2026-10-11 03:13:20 +00:00
2.6 KiB
2.6 KiB
phase, title, status, priority, effort, dependencies
| phase | title | status | priority | effort | dependencies | ||
|---|---|---|---|---|---|---|---|
| 3 | Tests + README | completed | P2 | 45m |
|
Phase 3: Tests + README
Overview
Cover the 6 record helpers with unit tests, add a card-level smoke test, and document the new card in README.md so it shows up in the gallery preview.
Requirements
Functional
- Helpers tested for: empty input, single-day, ties, all-zero counts
- Card-level test asserts
records.svgfilename + key strings appear (label rows, formatted values) - README updated:
- New row in card table at the same row index where it lands in
allCards - Dracula preview cell pointing at
./demo/dracula/records.svg
- New row in card table at the same row index where it lands in
Non-functional
- Test file follows existing convention (
*_test.goininternal/card) - No flaky time-based tests — pass
nowexplicitly intoaccountAgeYears
Architecture
internal/card/records_test.go
├── TestPeakDay (incl. ties → earliest)
├── TestPeakMonth (incl. ties → earliest, multi-month)
├── TestFirstActiveDay (incl. all-zero → zero time)
├── TestActiveDaysCount
├── TestAccountAgeYears (fixed createdAt vs fixed now)
├── TestLanguagesUsed
└── TestRecordsCardSVG (smoke: contains title + 6 row labels)
Related Code Files
- Create:
internal/card/records_test.go - Modify:
README.md(card table + dracula gallery cell) - Read for context:
internal/card/weekday_start_test.go(existing test patterns)
Implementation Steps
- Write helper unit tests with hand-rolled
[]DailyContributionfixtures. - Write card-level test asserting:
- SVG bytes contain
Records (all time)title - SVG contains 6 row labels (
Best day,Best month, ...) - Empty-fixture variant still renders without panic
- SVG bytes contain
go test ./...— confirm pass.- Update README:
- Card table: add row
15(or whatever index) with description - Gallery: add
<td><img src="./demo/dracula/records.svg" alt="records" /></td>to dracula preview block
- Card table: add row
- Trigger demo workflow regen (or rely on next push).
Success Criteria
- All new tests pass (
go test ./...) - README renders correctly (card table + gallery image link)
- Demo workflow produces
records.svgfor all 65 themes after merge
Risk Assessment
- Risk: Card-level snapshot test gets brittle as themes evolve. Mitigation: assert on text fragments only, never on full byte equality.
- Risk: README gallery layout breaks if the new image cell forces an odd column count. Mitigation: keep dracula gallery's
<table>row count even (pair with another card or span 2 cols).