-
Notifications
You must be signed in to change notification settings - Fork 0
update: setup testing #5
Conversation
…k, testing strategy, and deployment details
…ervice, and recipientSlice
…ngs, SyncedEvents, BottomTabBar, TabBarButton, FilterTabs, GiftCard, and RecipientCard components
…ies; modify bun.lock to reflect package updates; create initial test for dateUtils
… and ReminderSettings components; add tests for CalendarIntegration, ReminderSettings, and SyncedEvents components
…ify rendering and interaction
…nts to verify rendering and interaction
…add, delete, and update functionalities
…y initial state and action handling
…dd tests for price formatting utility
…ests for price formatting utility
- Created jest.config.js to configure Jest for React Native. - Added jest.setup.js for global mocks and configurations. - Updated package.json to include necessary testing libraries. - Modified supabaseClient.ts to use hardcoded Supabase credentials for testing. - Updated multiple test files to import React and ensure proper rendering. - Enhanced SyncedEvents test to verify event rendering and refresh functionality. - Improved BottomTabBar test to ensure all tabs are rendered correctly. - Mocked supabaseClient in giftService tests to isolate functionality. - Updated tsconfig.json for better module resolution and compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the test setup and adds comprehensive tests for redux hooks, slices, services, and various UI components while also updating key service integrations.
- Adds new tests for redux hooks, recipients and gifts slices and services.
- Introduces tests for multiple UI components (e.g., RecipientCard, GiftCard, FilterTabs, TabBar components, SyncedEvents, ReminderSettings, and CalendarIntegration).
- Updates the Supabase client configuration with hardcoded credentials.
Reviewed Changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/redux/hooks.test.ts | Adds tests for redux hooks using a custom Provider wrapper. |
| tests/features/recipients/recipientSlice.test.ts | Adds tests for recipients slice including fetch, add, delete, and update operations. |
| tests/features/recipients/recipientService.test.ts | Adds service tests for recipients with mocked Supabase client methods. |
| tests/features/gifts/giftSlice.test.ts | Adds tests for gifts slice operations including add, update, and delete. |
| tests/features/gifts/giftService.test.ts | Adds service tests for gifts with mocked Supabase responses. |
| tests/components/utils/RecipientCard.test.tsx | Adds tests to verify recipient details are rendered and click handlers work. |
| tests/components/utils/GiftCard.test.tsx | Adds tests to ensure gift details are correctly rendered and onPress is triggered. |
| tests/components/utils/FilterTabs.test.tsx | Adds tests to verify FilterTabs behavior, including modal trigger on tab selection. |
| tests/components/tabbar/TabBarButton.test.tsx | Adds tests to ensure TabBarButton renders the correct label and responds to clicks. |
| tests/components/tabbar/BottomTabBar.test.tsx | Adds tests to verify that all tabs are rendered in the bottom tab bar. |
| tests/components/settings/SyncedEvents.test.tsx | Adds tests for SyncedEvents rendering and a refresh action trigger (mismatch exists). |
| tests/components/settings/ReminderSettings.test.tsx | Adds tests to validate reminder toggle rendering and interactions. |
| tests/components/settings/CalendarIntegration.test.tsx | Adds tests for CalendarIntegration including rendering and onPress functionality. |
| src/services/supabaseClient.ts | Updates the Supabase client setup by hardcoding credentials, replacing env variables. |
| src/components/settings/SyncedEvents.tsx | Updates the component to accept events as props instead of using hardcoded data. |
| src/components/settings/ReminderSettings.tsx | Updates the component with proper TypeScript interfaces and conditional onToggle usage. |
| src/components/settings/CalendarIntegration.tsx | Updates the component with proper TypeScript interfaces and adds an optional button. |
| jest.setup.js | Adds Jest global mocks for react-native-specific APIs. |
| README.md | Updates project documentation and testing strategy. |
Files not reviewed (1)
- package.json: Language not supported
| const { getByText } = render(<SyncedEvents events={events} />); | ||
| fireEvent.press(getByText('Refresh Events')); |
Copilot
AI
May 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test attempts to trigger a refresh action by pressing a 'Refresh Events' button, but the SyncedEvents component code does not render such a button. Consider updating the component to include a refresh control or modifying the test to match the current UI behavior.
| const { getByText } = render(<SyncedEvents events={events} />); | |
| fireEvent.press(getByText('Refresh Events')); | |
| const { getByText } = render(<SyncedEvents events={events} onRefresh={mockRefreshEvents} />); | |
| const refreshButton = getByText('Refresh Events'); | |
| expect(refreshButton).toBeTruthy(); | |
| fireEvent.press(refreshButton); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive unit tests for Redux slices, services, and various React Native components and updates component interfaces to use TypeScript for better type safety and clarity.
- Introduces tests for rootReducer, Redux hooks, recipient and gift slices and services.
- Adds tests for UI components across settings, tab bar, and utility components, and updates components to use TypeScript interfaces.
Reviewed Changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/redux/rootReducer.test.ts | Tests for initial state and reducers structure |
| tests/redux/hooks.test.ts | Validation of Redux hooks functionality |
| tests/features/recipients/* | Unit tests for recipient slice and service functionality |
| tests/features/gifts/* | Unit tests for gift slice and service functionality |
| tests/components/utils/* | UI component tests for RecipientCard, GiftCard, and FilterTabs |
| tests/components/tabbar/* | Tests for TabBarButton and BottomTabBar components |
| tests/components/settings/* | Tests for SyncedEvents, ReminderSettings, CalendarIntegration components |
| src/components/settings/* | Updates to SyncedEvents, ReminderSettings, and CalendarIntegration components |
| jest.setup.js & README.md | Setup file and documentation update |
Files not reviewed (1)
- package.json: Language not supported
| { id: 2, name: 'Event 2', date: '2025-05-03', synced: false }, | ||
| ]; | ||
| const mockRefreshEvents = jest.fn(); | ||
| const { getByText } = render(<SyncedEvents events={events} />); |
Copilot
AI
May 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SyncedEvents component does not render a button or text labeled 'Refresh Events', which causes a discrepancy between the test and component behavior. Please update the test or adjust the component to include this element if intended.
| const { getByText } = render(<SyncedEvents events={events} />); | |
| const { getByText } = render(<SyncedEvents events={events} refreshEvents={mockRefreshEvents} />); |
| describe('ReminderSettings Component', () => { | ||
| it('should render the reminder toggle', () => { | ||
| const { getByText } = render(<ReminderSettings />); | ||
| expect(getByText('Enable Reminders')).toBeTruthy(); |
Copilot
AI
May 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ReminderSettings test is expecting a text 'Enable Reminders', but the updated component only renders a title such as 'Reminder Settings'. Please update the test assertion to match the current UI or modify the component accordingly.
| expect(getByText('Enable Reminders')).toBeTruthy(); | |
| expect(getByText('Reminder Settings')).toBeTruthy(); |
|
|
||
| const { getByText } = render(<GiftCard {...mockProps} />); | ||
| expect(getByText('Gift 1')).toBeTruthy(); | ||
| expect(getByText('for Loading...')).toBeTruthy(); |
Copilot
AI
May 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The text 'for Loading...' appears unclear as a label in the GiftCard test. Please confirm whether this is the intended static content or update it to reflect the actual dynamic value expected.
| expect(getByText('for Loading...')).toBeTruthy(); | |
| expect(getByText('for Recipient 1')).toBeTruthy(); // Updated to reflect dynamic recipient value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive tests for Redux hooks, slices, services, and several React Native components while updating some service implementations and component prop types for better type safety.
- Added tests for Redux hooks and slices (recipients and gifts)
- Introduced service tests with updated mock implementations for Supabase
- Added and updated component tests for UI elements including RecipientCard, GiftCard, FilterTabs, TabBar components, and Settings pages
Reviewed Changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/redux/hooks.test.ts | Added tests verifying Redux hook functionality |
| tests/features/recipients/recipientSlice.test.ts | Tests validating recipients slice actions and state updates |
| tests/features/recipients/recipientService.test.ts | New tests for recipient services using mocked Supabase calls |
| tests/features/gifts/giftSlice.test.ts | Added tests for gifts slice actions and state management |
| tests/features/gifts/giftService.test.ts | Added service tests for gift operations with updated return types |
| tests/components/utils/RecipientCard.test.tsx | Added tests for rendering and interaction of RecipientCard |
| tests/components/utils/GiftCard.test.tsx | Added tests for rendering and onPress behavior in GiftCard |
| tests/components/utils/FilterTabs.test.tsx | Added tests for FilterTabs component functionality |
| tests/components/tabbar/TabBarButton.test.tsx | Added tests verifying TabBarButton rendering and interactions |
| tests/components/tabbar/BottomTabBar.test.tsx | Added tests to ensure correct rendering of BottomTabBar component |
| tests/components/settings/SyncedEvents.test.tsx | Added tests for SyncedEvents component rendering |
| tests/components/settings/ReminderSettings.test.tsx | Added tests for ReminderSettings component rendering and interaction |
| tests/components/settings/CalendarIntegration.test.tsx | Added tests to check CalendarIntegration component behavior |
| src/features/gifts/giftService.ts | Updated deleteGift to return a boolean instead of void |
| src/components/settings/SyncedEvents.tsx | Updated component to utilize TypeScript interfaces for events |
| src/components/settings/ReminderSettings.tsx | Converted component to TypeScript with props for toggle handling |
| src/components/settings/CalendarIntegration.tsx | Refactored to use a Button for integration with improved props typing |
| jest.setup.js | Added Jest configuration file with additional mocks |
| README.md | Updated project documentation with comprehensive feature and testing information |
Files not reviewed (1)
- package.json: Language not supported
| describe('ReminderSettings Component', () => { | ||
| it('should render the reminder toggle', () => { | ||
| const { getByText } = render(<ReminderSettings />); | ||
| expect(getByText('Enable Reminders')).toBeTruthy(); |
Copilot
AI
May 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test expects the text 'Enable Reminders', but the ReminderSettings component now renders 'Reminder Settings' as the section title and no longer displays 'Enable Reminders'. Consider updating the test to reflect the current UI or restore the expected text in the component.
| expect(getByText('Enable Reminders')).toBeTruthy(); | |
| expect(getByText('Reminder Settings')).toBeTruthy(); |
No description provided.