Skip to content

feat: Priority 4 — test completeness#13

Merged
nitrocode merged 3 commits into
mainfrom
copilot/implement-priority-4
Apr 21, 2026
Merged

feat: Priority 4 — test completeness#13
nitrocode merged 3 commits into
mainfrom
copilot/implement-priority-4

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

  • Identify root cause: initLifeBlocks() (merged from main/PR#14) registers requestAnimationFrame(lbUpdateFrame) before requestAnimationFrame(updateCounters) inside init(), so the old mock.calls[0] was capturing lbUpdateFrame instead of updateCounters
  • Fix loadScript() in tests/script.test.js: change mock.calls[0] to mock.calls.at(-1) so it always captures the last-registered RAF callback (updateCounters)
  • Verified all 91 tests pass on the branch alone AND in the merged-with-main state

- Add formatTokenCountShort small-number test in death-clock.test.js
  covering the previously-uncovered line 251
- Add browser window export test via vm.runInNewContext (lines 443-444
  are browser-only dead code in Jest's Node env; behaviour verified)
- Add tests/script.test.js: jsdom integration/smoke tests for script.js
  DOM logic (renderMilestones, renderPredictionsTable, renderScoring,
  theme toggle, scoring toggle, updateCounters, getCurrentTokens growth,
  initChart, escHtml)
- Mark Priority 4 items as done in README.md
- Test count: 75 → 99, all passing; coverage 96% → 97% statements

Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/29387211-2b38-4246-a16e-ce7f3d18128e

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
@nitrocode nitrocode marked this pull request as ready for review April 14, 2026 13:47
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 14, 2026

👁️ PR Preview

🚀 Open Preview

Deployed from commit 8dc0153 · Updates on every push to this PR
(Preview is removed automatically when the PR is closed.)

- Remove 'Prompt & PR Quality Score' section from index.html
- Remove PROMPT_SCORING, computePromptScore from death-clock-core.js
- Remove renderScoring(), initScoringToggle() from script.js
- Fix CI test failures: add DOMContentLoaded fallback in loadScript()
  so tests pass regardless of jsdom readyState at eval() time
- Add formatTokenCountShort quintillion branch test (covers new branch)
- Remove scoring-related tests from both test files
- Coverage: branches 91.91% -> 93.68%, statements 97.19% -> 97.89%
- Tests: 99 -> 91 (8 scoring tests removed)

Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/9f382abf-841e-4725-84f2-0e008f9600ea

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Copilot AI requested a review from nitrocode April 14, 2026 14:05
init() now calls initLifeBlocks() which registers requestAnimationFrame(lbUpdateFrame)
before requestAnimationFrame(updateCounters). Capturing mock.calls[0] returned the
wrong callback; mock.calls.at(-1) always gets updateCounters regardless of how many
earlier RAF registrations exist.

Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/a0cc2007-2a00-4639-9c16-fc1d788bb684

Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
Copilot AI requested a review from nitrocode April 21, 2026 22:37
@nitrocode nitrocode merged commit 4a7f9bc into main Apr 21, 2026
3 checks passed
github-actions Bot added a commit that referenced this pull request Apr 21, 2026
@nitrocode nitrocode deleted the copilot/implement-priority-4 branch April 21, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants