silambarasan M
silambarasan M

Reputation: 11

How to write test case for react native redux and persist using just

I am writing test case for react native functional component application I am facing issue for redux and persist mocking

mock the redux and persist data in react native application

import React from 'react';
import Header from './Header';
import { Provider } from 'react-redux';
import { store } from '../../../store';
import { render } from '@testing-library/react-native';

const backButton = jest.fn;
const chatButton = jest.fn;
test('render correctly header', () => {
  const component = (
    <Provider store={store}>
      <Header
        title={''}
        onBackButton={backButton}
        onChatButton={chatButton()}
      />
    </Provider>
  );
  render(component);
});

I try to mock the backButton function and chatButton function render is not woking I am getting error

Upvotes: 1

Views: 221

Answers (0)

Related Questions