Skip to content

Commit

Permalink
Use act from testing library and unmount wrapper as last step in test
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Jun 27, 2023
1 parent 145a4d9 commit 8a8215d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Router } from 'react-router';
import { Provider } from 'react-redux';
import { mount } from 'enzyme';
import { Helmet } from 'react-helmet';
import { act } from 'react-dom/test-utils';
import { act } from '@testing-library/react';

import { PlanFormFieldsKeys } from '@opensrp/plan-form';
import { DRAFT_PLANS_LIST_VIEW_URL } from '../../../constants';
Expand Down Expand Up @@ -51,6 +51,8 @@ describe('Create Plan Page', () => {
expect((wrapper.find('Router').props() as any).history.location.pathname).toEqual(
DRAFT_PLANS_LIST_VIEW_URL
);

wrapper.unmount();
});

it('planForm gets configured', async () => {
Expand Down Expand Up @@ -110,5 +112,7 @@ describe('Create Plan Page', () => {

// date is hidden by default
expect(wrapper.find('FormItem#description').props().hidden).toBeFalsy();

wrapper.unmount();
});
});

0 comments on commit 8a8215d

Please sign in to comment.