Last active
March 3, 2017 18:25
-
-
Save avaly/11bd5ce8210938abc36092ef00a8fb45 to your computer and use it in GitHub Desktop.
ava-react-snapshot
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
{ | |
"dependencies": { | |
"ava": "^0.18.2", | |
"babel": "^6.23.0", | |
"babel-preset-react": "^6.23.0", | |
"babel-register": "^6.23.0", | |
"react": "^15.4.2", | |
"react-test-renderer": "^15.4.2" | |
}, | |
"babel": { | |
"presets": [ | |
"@ava/stage-4", | |
"react" | |
] | |
}, | |
"ava": { | |
"babel": "inherit", | |
"require": [ | |
"babel-register" | |
] | |
} | |
} |
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
const React = require('react'); | |
const Component = () => ( | |
<div> | |
<h1 className="foo"> | |
Hello World...! | |
</h1> | |
<p> | |
Lorem ipsum | |
</p> | |
</div> | |
); | |
module.exports = Component; |
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
const test = require('ava'); | |
const React = require('react'); | |
const render = require('react-test-renderer'); | |
const Component = require('./react'); | |
test('React', t => { | |
const tree = render.create(<Component />).toJSON(); | |
t.snapshot(tree); | |
}); |
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
exports[`React 1`] = `"{\"__ava_react_jsx\":{\"type\":\"div\",\"props\":{},\"children\":[{\"type\":\"h1\",\"props\":{\"className\":\"foo\"},\"children\":[\"Hello World...!\"]},{\"type\":\"p\",\"props\":{},\"children\":[\"Lorem ipsum\"]}]}}"`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment