Skip to content

test(coverage): #60, #58, #57, #20, #17 - #229

Open
nastaso wants to merge 1 commit into
mainfrom
test/coverage-batch
Open

test(coverage): #60, #58, #57, #20, #17#229
nastaso wants to merge 1 commit into
mainfrom
test/coverage-batch

Conversation

@nastaso

@nastaso nastaso commented Aug 5, 2026

Copy link
Copy Markdown
Owner

What does this PR do?

Closes #60, closes #58, closes #57, closes #20, closes #17.

Five test-only additions (one new file, four extended), no production code changed. Checked gh pr list for all five before starting - none had an existing open or merged PR (unlike #194/#111/#72/#51, already covered by contributor PRs #199/#200/#211/#201 and correctly excluded from this batch).

Testing

Implemented by codex gpt-5.6-sol, audited by me (Claude sonnet) per this session's routing. Audit lens: "does each test fail if the behaviour is broken? A test that passes against a mutant is not a test."

I hand-mutation-tested a sample covering the trickiest logic in three of the five: broke generate-og-images.mjs's hex value (drift guard went red, restored, confirmed green), removed the domain filter in selectExamQuestions (3 of 4 new tests went red, restored, confirmed green), and made toOriginalAnswer an identity no-op (multi-answer round trip caught it 8/8 runs; the single-answer round trip only caught it ~40% of runs because a random shuffle can coincidentally leave the answer key at a fixed point). Found and fixed one real gap in the process: rewrote the single-answer round-trip test to loop 30 shuffle attempts instead of relying on one, which took the false-negative rate to negligible (5/5 catches after the fix, re-verified against the same mutation).

  • npm run check (typecheck + lint + unit tests): 0 errors, 0 warnings, 317/317 tests pass (27 new).
  • No production files touched - confirmed via git diff --name-only against the base.

Checklist

  • npm run test / npm run check passes locally
  • npm run lint clean
  • No production code changed (test files only, one new: src/lib/levelAccent.test.ts)
  • No new dependencies
  • Mutation-verified (not just "passes today") on the highest-risk cases

#20 shuffleAndMapQuestions, #17 selectExamQuestions

Five independent test-only additions, no production code changed:

- #60 maybeNotifyGoogleLink: dispatch-once, silent-repeat, silent-when-unlinked
- #58 levelAccent.test.ts (new): cross-file drift guard against
  scripts/generate-og-images.mjs's LEVEL_ACCENT, key coverage, hex/RGB parity
- #57 goToLogin: from-state composition, empty search/hash, call count/shape
- #20 shuffleAndMapQuestions: keymap-per-question, content preservation,
  single- and multi-answer round trips via toOriginalAnswer
- #17 selectExamQuestions: exact-quota, small-pool shortfall, no duplicates,
  domain isolation

Mutation-tested by hand against all five (break the real behavior, confirm
red, restore, confirm green). One real gap found and fixed in the process:
the #20 single-answer round-trip test only caught a broken toOriginalAnswer
~40% of the time, because the random shuffle can leave the answer key at a
fixed point by chance, silently missing the mutation the rest of the time.
Rewrote it to loop 30 shuffle attempts per assertion instead of one, which
drove the false-negative rate to negligible (5/5 mutation runs now catch it).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying cloudcertprep with  Cloudflare Pages  Cloudflare Pages

Latest commit: afd11ca
Status: ✅  Deploy successful!
Preview URL: https://c3f07376.cloudcertprep.pages.dev
Branch Preview URL: https://test-coverage-batch.cloudcertprep.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment