Created
March 19, 2020 02:02
-
-
Save joshtch/8f75259a21b0be59058e916beb4035f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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