score:0

store = createStore(reducer, initialState)

score:2

import { render, fireEvent } from '@testing-library/react';
import '@testing-library/react/cleanup-after-each';

import { useDispatch } from 'react-redux';
import faker from 'faker';
import { NewTemplateForm } from './NewTemplateForm';

import { templatePostThunk } from '../../../redux/actions/templatePost';
import { viewTemplateUrl } from '../../../utils/urls';

jest.mock('../../../redux/actions/templatePost');
jest.mock('../../../utils/urls');
jest.mock('react-redux');

describe('<NewTemplateForm/> controller component', () => {
  useDispatch.mockImplementation(() => cb => cb());
  const setup = () => {
    const props = {
      history: {
        push: jest.fn(),
      },
    };
    const templateId = faker.random.number();
    viewTemplateUrl.mockImplementationOnce(() => () => {});
    templatePostThunk.mockImplementationOnce(() => async () => ({
      data: { id: templateId },
    }));
    const { container, getByText, getByLabelText, rerender, debug } = render(
      <NewTemplateForm {...props} />
    );

Related Query

More Query from same tag