Skip to content

test: cover untested public API in smoke.mjs (journey + knownThemes) - #21

Open
ashishbhateja wants to merge 1 commit into
mainfrom
smoke-journey-coverage
Open

ashishbhateja wants to merge 1 commit into
mainfrom
smoke-journey-coverage

Conversation

@ashishbhateja

Copy link
Copy Markdown
Owner

What this changes

Adds 5 new assertions to scripts/smoke.mjs, bringing the check count from 19 to 24. Every new check exercises exported API that existed but had no coverage.

journey.js

  • monthsOfMovement — the function was not imported or called anywhere in the test suite. New check verifies it returns the five "ground" movement months in calendar order with correct themes.
  • movementOf(arc, number) — the existing test only called movementOf with a month object; the alternate branch that takes a raw number and calls monthByNumber internally was never reached. New check exercises it with August (presence) and September (forward).
  • mirrorOf reverse lookup — both January and December carry an explicit mirrors field in the real arc, so the reverse-lookup branch (arc.months.find(m => m.mirrors === number)) was unreachable in every existing test. New check builds a minimal synthetic arc where only one side declares the link, forcing that branch.
  • mirrorOf null return — no assertion confirmed that months with no mirror partner (May, July) return null.

personalize.js

  • Personalizer.knownThemes() — public method exported and documented, zero coverage. New check confirms it returns the union of declared interests and implicit affinity built from reading history, and excludes unseen themes.

Why

These are real code paths that ship in every build. A bug in any of them (e.g. a refactor that accidentally breaks monthsOfMovement's sort, or the mirrorOf reverse-lookup path) would go undetected. The coverage gap was the only reason to open this PR.

Checklist

  • node scripts/smoke.mjs passes (24 checks)
  • No new runtime dependencies
  • No UI changes
  • No magazine content committed (developed against the sample edition)

Generated by Claude Code

Four exported symbols had no smoke-test coverage:

- `monthsOfMovement` — not imported or exercised at all; new check
  verifies it returns the five "ground" months in calendar order with
  correct themes.
- `movementOf(arc, number)` — only the object-argument path was tested;
  new check exercises the number path (the branch that calls
  `monthByNumber` internally) with August and September.
- `mirrorOf` reverse lookup — both January and December carry an
  explicit `mirrors` field in the real arc, so the reverse-lookup
  branch (`arc.months.find(m => m.mirrors === number)`) was dead in
  every existing test. New check builds a minimal synthetic arc where
  only one side declares the link, forcing the reverse path.
- `mirrorOf` null return — added an assertion that months with no
  mirror partner (May, July) return null.
- `Personalizer.knownThemes()` — public method, zero coverage; new
  check verifies it unions declared interests with implicit affinity
  built from reading history.

19 → 24 checks, all green. Build unchanged.

This branch has not been deployed

No deployments
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