Skip to content

Conversation

@rohan-pandeyy
Copy link
Contributor

@rohan-pandeyy rohan-pandeyy commented Jan 21, 2026

closes #889

Description

Addressing the need for a reliable, modern testing baseline for the frontend. This PR introduces a layered testing strategy, adds sanity tests for core pages (Home, Settings), and modernizes the testing infrastructure to be robust and leak-free.

Changes

Infrastructure

  • Test Utils: src/test-utils.tsx with a customRender function that wraps components in Redux, Router, and Theme providers.
  • Fresh Store: src/app/store.ts and test utils to create a fresh Redux store for every test run. prevents state leakage.

New Tests

  • Sidebar.test.tsx: Verifies that the sidebar renders and contains all critical navigation links (Home, Tagging, Settings, etc.).
  • PageSanity.test.tsx:
    • Home: Checks for the "Image Gallery" title or Empty State. Uses await findByText to gracefully handle async loading states.
    • Settings: Verifies the presence of key sections ("Folder Management", "User Preferences", "Application Controls") and specific interactions.

Checklist

  • Sanity Tests:
    • Sidebar Navigation
    • Home Page Structure
    • Settings Page Sections

Summary by CodeRabbit

  • Tests

    • Added test coverage for Sidebar navigation and core application pages (Home, Settings).
  • Chores

    • Enhanced test infrastructure with improved mock setup and consolidated test utilities for more reliable and maintainable test environment.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added CI/CD enhancement New feature or request test labels Jan 21, 2026
@rohan-pandeyy rohan-pandeyy changed the title CI/CD: Refresh Frontend Sanity Tests & Infrastructure CI/CD: Refresh Frontend Test Suites Jan 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Updates frontend test infrastructure by adding comprehensive Tauri and Axios mocking in jest.setup.ts, refactoring store.ts to export rootReducer, and introducing new test files and utilities for component and page testing.

Changes

Cohort / File(s) Summary
Test Infrastructure Setup
frontend/jest.setup.ts, frontend/src/test-utils.tsx
Adds extensive Tauri and Axios mocks in jest.setup.ts (+92 lines) for deterministic test isolation. Introduces test-utils.tsx (+69 lines) with AllTheProviders wrapper component, CustomRenderOptions interface, and customRender function that injects Redux store, theme context, Tanstack Query client, and MemoryRouter for component testing.
Store Configuration
frontend/src/app/store.ts
Refactors store configuration by exporting a new rootReducer via combineReducers and simplifying store setup to use reducer: rootReducer instead of inline object definition (+13/-11 lines).
Component & Page Tests
frontend/src/components/Navigation/Sidebar/__tests__/Sidebar.test.tsx, frontend/src/pages/__tests__/PageSanity.test.tsx
Adds new test suite for Sidebar component validating navigation items presence (+22 lines). Introduces PageSanity.test.tsx with sanity tests for Home and Settings pages (+31 lines), asserting key UI sections and controls are rendered.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

enhancement

Poem

🐰 bounces with joy
Jest and mocks in jest.setup dance,
New test-utils give tests a chance,
Components and pages now tested true,
Infrastructure built for a rendezvous!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully addresses all coding objectives from issue #889: establishes modern test infrastructure (test-utils, rootReducer export), adds core navigation tests (Sidebar.test.tsx), and implements critical page sanity tests (PageSanity.test.tsx).
Out of Scope Changes check ✅ Passed All changes are scoped to frontend testing infrastructure and sanity tests as defined in issue #889; no unrelated modifications detected across files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately reflects the main objective of the PR: refreshing frontend test infrastructure and adding sanity tests for core pages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD enhancement New feature or request test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI/CD: Outdated Frontend Test Suites

1 participant