Skip to content

test: cover Officer Learning progress and proposal draft edges - #25

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-f6b4
Draft

test: cover Officer Learning progress and proposal draft edges#25
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/missing-test-coverage-f6b4

Conversation

@cursor

@cursor cursor Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds unit coverage for recent Officer Learning quiz/progress QOL and the still-untested Proposal Tracker draft validator. Production code is unchanged.

Risky behavior now covered

  • Device progress can no longer silently lose a passing quiz, shrink scroll depth, or write through quota/corrupt JSON without a failing test.
  • Quiz “next module” navigation follows the catalog; reduced-motion scroll and first-radio focus stay wired.
  • Hub sync after a pass only PUTs when hubSyncEnabled is already on; Me/local-settings Zod schemas still reject tenant identity keys and shareWithLocal without sync.
  • Local completion reports stay union-scoped even when localId collides.
  • Proposal Tracker drafts reject invalid status/shape and ignore corrupt localStorage.

Test files added/updated

  • Added: src/lib/officer-learning/progress.test.ts, modules.test.ts, hub-sync-client.test.ts, src/lib/proposal-tracker/draft.test.ts, src/lib/validation/officer-learning.test.ts
  • Updated: quiz-scroll.test.ts, hub-store.test.ts, related-resources.test.ts, parse-module.test.ts, src/lib/rules-of-order/actions.test.ts

Why this reduces regression risk

These are shared utilities and core flows (progress persistence, tenancy, request validation) that the 2026-08-28 quiz navigation and Hub-sync work depended on without unit tests. Failures here lose steward progress or leak another union’s completions — not cosmetic chrome.

Checklist

  • No secrets, .env, keys, or real member/PII data
  • User-facing strings updated in both messages/en.json and messages/fr.json (if applicable)
  • Role/tenancy rules respected (unionId scoping; no cross-union access)
  • npm run lint and npm run test:unit pass
  • Smoke tests run if UI/routes changed (npm run test:smoke)
  • Docs updated if setup/deploy/privacy behaviour changed

Test plan

  • npm run test:unit -- src/lib/officer-learning/progress.test.ts src/lib/officer-learning/modules.test.ts src/lib/officer-learning/quiz-scroll.test.ts src/lib/officer-learning/hub-sync-client.test.ts src/lib/officer-learning/hub-store.test.ts src/lib/officer-learning/related-resources.test.ts src/lib/officer-learning/parse-module.test.ts src/lib/proposal-tracker/draft.test.ts src/lib/validation/officer-learning.test.ts src/lib/rules-of-order/actions.test.ts
  • Result this run: 10 files, 52 tests, all passed
  • ESLint on the touched test files: clean
  • No production behaviour change; smoke not required
Open in Web View Automation 

Recent quiz navigation and Hub sync QOL changed production paths with little unit coverage. Lock the device progress state machine, tenancy/sync guards, and on-device proposal draft validation so those regressions fail in CI instead of on the floor.

Co-authored-by: Ryan Morris <ryan@ryanmorris.ca>
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.

1 participant