mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix rtl-test example & add Snapshot testing (#5981)
This commit is contained in:
parent
fd3cb2a190
commit
85fd832ed8
|
@ -0,0 +1,11 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`With React Testing Library Snapshot Should match Snapshot 1`] = `
|
||||||
|
<DocumentFragment>
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
Hello World!
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</DocumentFragment>
|
||||||
|
`;
|
|
@ -12,3 +12,11 @@ describe('With React Testing Library', () => {
|
||||||
expect(getByText('Hello World!')).not.toBeNull()
|
expect(getByText('Hello World!')).not.toBeNull()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('With React Testing Library Snapshot', () => {
|
||||||
|
it('Should match Snapshot', () => {
|
||||||
|
const { asFragment } = render(<App />)
|
||||||
|
|
||||||
|
expect(asFragment()).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
"react-dom": "latest"
|
"react-dom": "latest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.1.2",
|
||||||
|
"babel-core": "^7.0.0-bridge",
|
||||||
|
"babel-jest": "^23.6.0",
|
||||||
"react-testing-library": "^5.4.2",
|
"react-testing-library": "^5.4.2",
|
||||||
"jest": "^23.6.0"
|
"jest": "^23.6.0"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue