Created
August 26, 2018 08:47
-
-
Save georgschlenkhoff/9ebf76a538fbd5b485a5a2bbe128f8f0 to your computer and use it in GitHub Desktop.
React Jest test
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
import React from 'react'; | |
import TestRenderer from 'react-test-renderer'; | |
import TextField from './TextField'; | |
function MyComponent() { | |
return <TextField placeholder="bar" />; | |
} | |
const testRenderer = TestRenderer.create(<MyComponent />); | |
const testInstance = testRenderer.toJSON(); | |
it('should be a div', () => { | |
expect(testInstance.type).toBe('div'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment