Skip to content
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

Add jest.useFakeTimers() in jestSetup.js #2818

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

heecheolman
Copy link

Description

✅ Success Case

❌ Fail Case

👉 So, I added jest.useFakeTimers() in jestSetup.js

Test plan

  1. Setup project, without "react-native-reanimated" package.
  2. Setup Jest
  3. Write this simple test code.
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
import { Text } from 'react-native';
import { render, screen } from '@testing-library/react-native';

describe('Test', () => {
  it('Success', () => {
      function TestComponent() {
        const gesture = Gesture.Pan().onEnd(() => {});

        return (
          <GestureDetector gesture={gesture}>
              <Text>DummyText</Text>
          </GestureDetector>
      }

      render(<TestComponent />);
      expect(screen.getByText('DummyText')).toBeOnTheScreen();
  });
})

@j-piasecki
Copy link
Member

Can you share more details about the setup where your tests were failing? Like the versions of:

  • react-native-gesture-handler
  • react
  • react-native
  • @testing-library/react-native
  • react-test-renderer

Or preferably, can you set up a repository with a project where the test is failing because of Gesture Handler?

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.

None yet

2 participants