fix: add initial value on summits to avoid crash checking length - #313
Conversation
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
📝 WalkthroughWalkthrough
ChangesSummits dropdown
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/mui/summits-dropdown.js (1)
23-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression test for the omitted
summitsprop.The current tests pass
summits={[]}explicitly. Add a test that omits the prop and verifies rendering andfetchAllSummitsinvocation. This test will protect the crash fix.🧪 Proposed regression test
+ test("defaults summits to an empty array when omitted", async () => { + render(<SummitsDropdown onChange={jest.fn()} />); + await waitFor(() => { + expect( + require("../../../utils/query-actions").fetchAllSummits + ).toHaveBeenCalled(); + }); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/mui/summits-dropdown.js` at line 23, Add a regression test for the `SummitsDropdown` component that omits the `summits` prop entirely, verifies it renders successfully, and confirms `fetchAllSummits` is invoked. Keep the existing explicit empty-array coverage unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/components/mui/summits-dropdown.js`:
- Line 23: Add a regression test for the `SummitsDropdown` component that omits
the `summits` prop entirely, verifies it renders successfully, and confirms
`fetchAllSummits` is invoked. Keep the existing explicit empty-array coverage
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 804cd759-bc44-46c3-9a98-92886bd9904e
📒 Files selected for processing (1)
src/components/mui/summits-dropdown.js
ref: https://app.clickup.com/t/9014802374/86bakf3mp
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit