Created
March 2, 2018 16:33
-
-
Save bruceharris/d4ec5f4aff437b7de772e69138d9eba2 to your computer and use it in GitHub Desktop.
React Unit Testing Example 15
This file contains 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
describe('on unmount', () => { | |
it('should clear timeout', () => { | |
jest.useFakeTimers(); | |
const wrapper = mount( | |
<LoadingIndicator isLoading={true}> | |
<div>ahoy!</div> | |
</LoadingIndicator> | |
); | |
wrapper.unmount(); | |
expect(clearTimeout.mock.calls.length).toEqual(1); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment