test(15-2): hook integration tests — usePronunciation full mocked-API coverage#112
Merged
Merged
Conversation
5 tasks
3-agent adversarial review surfaced 9 actionable findings on the usePronunciation hook integration test. HIGH: - BH-1 + EH-7 + EH-10: weakSounds assertion missing entirely. Added explicit empty-state assertion to Case 3 (default fixture scores ≥ 80 → identifyWeakSounds returns []). NEW Case 3b uses a low-scoring × 3 same-phoneme fixture so the aggregator actually produces a non-empty weakSounds list — pins the full integration wiring (hook → identifyWeakSounds → state.weakSounds). - BH-2: Case 13 only tested snapshot-at-mount, not mirroring. NEW Case 13b uses renderer.update + flipped mock to verify the hook reflects recorder state CHANGES, not just initial-render values. - EH-1: no audio-permission-denied path. NEW Case 4b stubs hasPermission:false + recorder.error + stopRecording → null and verifies the hook routes through the no-audio branch without firing captureError (user-driven, not Sentry-page-worthy). - EH-8: Case 12 FIFO check didn't pin non-containment. Added explicit `history.some(h => h.accuracyScore === 0)).toBe(false)` so a regression that evicts from the tail (LIFO) or fails to evict at all is caught. - EH-9: no transient isAssessing assertion. NEW Case 6b uses a hand-rolled deferred promise (Story 13-3 P8 pattern) to verify isAssessing flips true mid-Azure-call and false after settle. MED: - BH-5: NEW Case 8c asserts assessFromUri callback reference is stable across re-renders (pins useCallback empty-deps contract). - BH-6: added `expect(isAssessing).toBe(false)` assertion to Case 2 pinning that startAssessment does NOT set isAssessing — only finishAssessment does (Azure call in-flight semantic). - EH-4: NEW Case 9b verifies clearResult on initial empty state is a no-op (pre-init defense). - EH-6: NEW Case 8b stubs readAsStringAsync rejection (real-world cached-file-gone race) and verifies captureError + error surfaced + assessPronunciation NOT called. Deferred (filed as follow-ups): - 15-2-followup-reentrant-guard (EH-3 — low real-world hazard) - 15-2-followup-getweakphonemes-ref-stability (EH-5) - 15-2-followup-permission-denied-distinct-error (UX decision) - 15-2-followup-distinct-fs-error-tag (telemetry granularity) Story file housekeeping: Status: review → done; populated File List + Completion Notes per Acceptance Auditor APPROVE_WITH_NOTES. +7 net test cases (13 → 20). All 4 quality gates green: type-check 0 / lint 0 / prettier clean / jest 2179 tests pass (+7 from this PR).
Simplemart17
added a commit
that referenced
this pull request
May 17, 2026
…ters Symmetry with 15-4/15-5/15-6 entries (added in the retro commit). Pre-edit the 15-2 + 15-3 lines were plain 'backlog' with no PR pointer; reviewers of PR #117 had no in-file signal that those stories were in flight via PRs #112 and #113. Each line now reads: 'backlog # PR #NNN open — status flips to "done" when PR merges' matching the established pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/hooks/__tests__/use-pronunciation.test.tsx(13 cases) closes the largest hook-test gap.usePronunciationhad zero direct coverage; the other 3 hooks in the spec inventory have substantial shape/binding tests already (Stories 12-2 / 10-8 / 12-1 P8). Full-flow integration extensions to those existing test files deferred to15-2-followup-existing-hook-flow-integrationper Epic 14 retro lesson.assessPronunciationlib boundary).Story
15-2-hook-integration-tests_bmad-output/implementation-artifacts/15-2-hook-integration-tests.mdTest plan
npx jest --no-coveragepasses — +13 net cases (2159 → 2172).captureError("pronunciation-assessment")+ classifyError-routed error).🤖 Generated with Claude Code