Skip to content

Instantly share code, notes, and snippets.

@joshtch
Created March 19, 2020 02:02
Show Gist options
  • Save joshtch/8f75259a21b0be59058e916beb4035f1 to your computer and use it in GitHub Desktop.
Save joshtch/8f75259a21b0be59058e916beb4035f1 to your computer and use it in GitHub Desktop.
import * as React from 'react';
import { act, create } from 'react-test-renderer';
import App from '../App';
jest.mock('expo', () => ({
Linking: {
makeUrl: () => '/',
},
SplashScreen: {
preventAutoHide: () => 'preventAutoHide',
hide: () => 'hide',
},
}));
describe('App', () => {
jest.useFakeTimers();
let tree;
it(`renders correctly`, async () => {
// act is used to prevent snapshot returning null
await act(async () => {
tree = await create(<App />);
});
expect(tree.toJSON()).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment