test: cover intelligence tab states#1876
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a Vitest + React Testing Library test suite for Intelligence tabs, mocking ActionableCard and providing helpers to build items and render the Memory tab; tests cover Dreams placeholder, Memory filters, multiple UI states, empty messages, and actionable card actions. ChangesIntelligence Tab Panel Tests
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 (2)
app/src/components/intelligence/__tests__/IntelligenceTabs.test.tsx (2)
52-74: ⚡ Quick winDeduplicate
IntelligenceMemoryTabdefault props to prevent drift.
renderMemoryTabandrenderMemoryTabPropsduplicate the same defaults. Use a single builder and haverenderMemoryTabcall it.Proposed refactor
-function renderMemoryTab( - overrides: Partial<React.ComponentProps<typeof IntelligenceMemoryTab>> = {} -) { - const props: React.ComponentProps<typeof IntelligenceMemoryTab> = { - handleAnalyzeNow: vi.fn().mockResolvedValue(undefined), - handleComplete: vi.fn().mockResolvedValue(undefined), - handleDismiss: vi.fn(), - handleSnooze: vi.fn().mockResolvedValue(undefined), - isRunning: false, - items: [], - itemsLoading: false, - searchFilter: '', - setSearchFilter: vi.fn(), - setSourceFilter: vi.fn(), - sourceFilter: 'all', - timeGroups: [], - usingMemoryData: false, - ...overrides, - }; +function renderMemoryTab( + overrides: Partial<React.ComponentProps<typeof IntelligenceMemoryTab>> = {} +) { + const props = renderMemoryTabProps(overrides); render(<IntelligenceMemoryTab {...props} />); return props; }Also applies to: 164-183
🤖 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 `@app/src/components/intelligence/__tests__/IntelligenceTabs.test.tsx` around lines 52 - 74, The default props for IntelligenceMemoryTab are duplicated between renderMemoryTab and renderMemoryTabProps; create a single builder (e.g., buildIntelligenceMemoryTabProps) that constructs and returns the React.ComponentProps<typeof IntelligenceMemoryTab> object and have both renderMemoryTab and renderMemoryTabProps call that builder and then apply any overrides; update references to handleAnalyzeNow, handleComplete, handleDismiss, handleSnooze, isRunning, items, itemsLoading, searchFilter, setSearchFilter, setSourceFilter, sourceFilter, timeGroups and usingMemoryData to come from the shared builder so defaults are centralized (also update the other duplicate at the 164-183 region to use the same builder).
1-3: ⚡ Quick winUse the shared app test render harness instead of a local harness.
Prefer
app/src/test/test-utils.tsxfor rendering so provider/context setup stays consistent across tests, then keep this file focused on scenario inputs/assertions.As per coding guidelines: "Use existing test helpers from
app/src/test/(test-utils.tsx, shared mock backend) before adding new harness code in Vitest."Also applies to: 52-74
🤖 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 `@app/src/components/intelligence/__tests__/IntelligenceTabs.test.tsx` around lines 1 - 3, The test currently uses local testing-library render harness; switch to the shared app test harness by importing and using the render helper from app/src/test/test-utils.tsx (replace the current render import from '`@testing-library/react`') and use the shared mock backend helpers instead of any local mock setup; also remove the local harness/fixture code between lines 52-74 so the tests in IntelligenceTabs.test.tsx rely on the centralized provider/context setup and only assert scenario behavior (update all references to render/fireEvent/screen to use the shared render semantics).
🤖 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 `@app/src/components/intelligence/__tests__/IntelligenceTabs.test.tsx`:
- Around line 52-74: The default props for IntelligenceMemoryTab are duplicated
between renderMemoryTab and renderMemoryTabProps; create a single builder (e.g.,
buildIntelligenceMemoryTabProps) that constructs and returns the
React.ComponentProps<typeof IntelligenceMemoryTab> object and have both
renderMemoryTab and renderMemoryTabProps call that builder and then apply any
overrides; update references to handleAnalyzeNow, handleComplete, handleDismiss,
handleSnooze, isRunning, items, itemsLoading, searchFilter, setSearchFilter,
setSourceFilter, sourceFilter, timeGroups and usingMemoryData to come from the
shared builder so defaults are centralized (also update the other duplicate at
the 164-183 region to use the same builder).
- Around line 1-3: The test currently uses local testing-library render harness;
switch to the shared app test harness by importing and using the render helper
from app/src/test/test-utils.tsx (replace the current render import from
'`@testing-library/react`') and use the shared mock backend helpers instead of any
local mock setup; also remove the local harness/fixture code between lines 52-74
so the tests in IntelligenceTabs.test.tsx rely on the centralized
provider/context setup and only assert scenario behavior (update all references
to render/fireEvent/screen to use the shared render semantics).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f844676e-7515-4c84-8606-7d0f94c08033
📒 Files selected for processing (1)
app/src/components/intelligence/__tests__/IntelligenceTabs.test.tsx
|
Updated after CI/review: the tests now use |
Summary
Refs #1870
Verification
Notes
Summary by CodeRabbit