Skip to content

Commit

Permalink
Remove act from tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lindapaiste committed Aug 7, 2023
1 parent ba4cc1f commit 23d1478
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { render, screen, fireEvent } from '../../../../test-utils';
import OnOffToggle from './OnOffToggle';

Expand Down Expand Up @@ -43,19 +42,15 @@ describe('OnOffToggle', () => {
it('does nothing when clicking the active value', () => {
const { onButton } = subject(true);

act(() => {
fireEvent.click(onButton);
});
fireEvent.click(onButton);

expect(setValue).not.toHaveBeenCalled();
});

it('calls setValue when clicking the inactive value', () => {
const { offButton } = subject(true);

act(() => {
fireEvent.click(offButton);
});
fireEvent.click(offButton);

expect(setValue).toHaveBeenCalledTimes(1);
expect(setValue).toHaveBeenCalledWith(false);
Expand Down

0 comments on commit 23d1478

Please sign in to comment.