In the React Native project, the state is updated using reducer but is not able to mock the value.
In the App.tsx file below, the itemData value is being updated with reducer at regular interval. But the code for the updated value condition is not being covered in unit testing.
Below is the App.spec.tsx file for unit testing
import 'react-native';
import React from 'react';
import App from '../App';
import { fireEvent, render, waitFor } from '@testing-library/react-native';
import {it} from '@jest/globals';
it('renders correctly', async () => {
const wrapper = render(<App />);
await waitFor(() => {
fireEvent.press(wrapper.getByTestId('item-click'));
expect(wrapper).toBeTruthy();
});
});
Is there any possible way to mock the state to get the coverage?