YPE-1157: test(hooks) - useChapterNavigation#185
Conversation
Rewrite useChapterNavigation tests with 19 cases covering boundary navigation, cross-book nav, intro chapters, loading/empty states, currentChapterIndex, and edge cases. 93%+ statement coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Greptile SummaryThis PR rewrites Key improvements:
Confidence Score: 5/5
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[navigateToNext / navigateToPrevious] --> B{getAdjacentChapter<br/>returns null?}
B -->|yes - boundary reached| C[no-op]
B -->|no| D[navigate result]
D --> E{result is null OR<br/>booksData empty?}
E -->|yes| C
E -->|no| F[Find targetBook<br/>in booksData]
F --> G{targetBook<br/>found?}
G -->|no| C
G -->|yes| H[Find targetChapter<br/>in chapters OR intro]
H --> I{targetChapter<br/>found?}
I -->|no - e.g. next book has<br/>no canonical chapters| C
I -->|yes| J{Different book?}
J -->|yes| K[setBook + setChapter]
J -->|no| L[setChapter only]
style C fill:#f9f,stroke:#333
style K fill:#9f9,stroke:#333
style L fill:#9f9,stroke:#333
Last reviewed commit: c94aeb9 |
…no-op case Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile, please re-review this again. Update your previous review when complete |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile the reptile, please re-re-review this PR against the latest changes. Then, update the PR description |
…ooks array Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile, please re-re-re-review this PR. Update the PR comment with your updates. |
|
Even though I spent time doing this, I will close this because in #187 I realized it's not needed and not used. Therefore it's getting deprecated. |
Rewrites
useChapterNavigation.test.tsxfrom 7 tests to 19, covering: boundary navigation (Bible start/end), middle-chapter bidirectional nav, cross-book transitions, intro chapter handling, loading state, empty books array,currentChapterIndexcalculation, and no-op edge cases.93%+ statement coverage, 100% function/line coverage.
Completes YPE-1157