Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Conversation

@bakaqc
Copy link
Member

@bakaqc bakaqc commented May 3, 2025

No description provided.

bakaqc added 16 commits May 2, 2025 14:44
…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
- 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.
@bakaqc bakaqc added enhancement New feature or request good first issue Good for newcomers labels May 3, 2025
@bakaqc bakaqc self-assigned this May 3, 2025
Copy link

Copilot AI left a 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

Comment on lines +23 to +24
const { getByText } = render(<SyncedEvents events={events} />);
fireEvent.press(getByText('Refresh Events'));
Copy link

Copilot AI May 3, 2025

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
@bakaqc bakaqc requested a review from Copilot May 3, 2025 09:08
Copy link

Copilot AI left a 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} />);
Copy link

Copilot AI May 3, 2025

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.

Suggested change
const { getByText } = render(<SyncedEvents events={events} />);
const { getByText } = render(<SyncedEvents events={events} refreshEvents={mockRefreshEvents} />);

Copilot uses AI. Check for mistakes.
describe('ReminderSettings Component', () => {
it('should render the reminder toggle', () => {
const { getByText } = render(<ReminderSettings />);
expect(getByText('Enable Reminders')).toBeTruthy();
Copy link

Copilot AI May 3, 2025

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.

Suggested change
expect(getByText('Enable Reminders')).toBeTruthy();
expect(getByText('Reminder Settings')).toBeTruthy();

Copilot uses AI. Check for mistakes.

const { getByText } = render(<GiftCard {...mockProps} />);
expect(getByText('Gift 1')).toBeTruthy();
expect(getByText('for Loading...')).toBeTruthy();
Copy link

Copilot AI May 3, 2025

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.

Suggested change
expect(getByText('for Loading...')).toBeTruthy();
expect(getByText('for Recipient 1')).toBeTruthy(); // Updated to reflect dynamic recipient value

Copilot uses AI. Check for mistakes.
@bakaqc bakaqc requested a review from Copilot May 4, 2025 09:55
Copy link

Copilot AI left a 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();
Copy link

Copilot AI May 4, 2025

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.

Suggested change
expect(getByText('Enable Reminders')).toBeTruthy();
expect(getByText('Reminder Settings')).toBeTruthy();

Copilot uses AI. Check for mistakes.
@hardingadonis hardingadonis merged commit f560390 into main May 4, 2025
@hardingadonis hardingadonis deleted the feature/testing branch May 4, 2025 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants