How to use the react-hooks-testing-library.act function in react-hooks-testing-library

To help you get started, we’ve selected a few react-hooks-testing-library examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github roginfarrer / react-collapsed / src / __tests__ / collapse.jest.js View on Github external
test('toggleOpen toggles isOpen', () => {
  const {result} = renderHook(useCollapse);
  const {toggleOpen} = result.current;
  act(toggleOpen);
  const {isOpen} = result.current;
  expect(isOpen).toBe(true);
});
github roginfarrer / react-collapsed / src / __tests__ / collapse.hook.jest.js View on Github external
test('toggleOpen toggles isOpen', () => {
  const {result} = renderHook(useCollapse);
  const {toggleOpen} = result.current;
  act(toggleOpen);
  const {isOpen} = result.current;
  expect(isOpen).toBe(true);
});

react-hooks-testing-library

Simple component wrapper for testing React hooks

MIT
Latest version published 6 years ago

Package Health Score

61 / 100
Full package analysis

Popular react-hooks-testing-library functions

Similar packages