Skip to content

feat: adds onTimeout option to waitFor #885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

jmbeach
Copy link
Contributor

@jmbeach jmbeach commented Dec 27, 2021

Summary

Adds the option onTimeout?: (error: Error) => Error to the waitFor function to match the option in the non-native React Testing Library.

Test plan

I added a new test for this as well.

Useful so that you can do stuff like this:

await waitFor(() => expect(getSlotMachine().props.accessibilityState.disabled).toBeFalsy(), {
    onTimeout: (e) => {
      console.log(getSlotMachine().props.accessibilityState.disabled)
      expect(wrapper).toMatchSnapshot();
      return e;
    }
  });

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@thymikee thymikee merged commit 6667cc2 into callstack:main Jan 10, 2022
@jmbeach jmbeach deleted the waitFor-onTimeout branch January 10, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants