Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
Created January 8, 2024 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remarkablemark/48bd1f41b0144bb0b986b1a33d0186fb to your computer and use it in GitHub Desktop.
Save remarkablemark/48bd1f41b0144bb0b986b1a33d0186fb to your computer and use it in GitHub Desktop.

You would do the same thing except after renderHook():

await act(() => {
  const [myMutation] = result.current;
  myMutation(/* your args */);
});

expect(result.current[1]).toEqual({
  // your object
});

You can import act() from:

import { act } from '@testing-library/react-native';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment