1
0
mirror of https://github.com/uetchy/namae.git synced 2025-10-15 07:32:19 +09:00

test: setup

This commit is contained in:
2019-08-03 00:35:23 +09:00
parent 48271c4ba2
commit 97ef88b8e4
6 changed files with 122 additions and 18 deletions

View File

@@ -5,6 +5,7 @@
"build": "react-scripts build",
"eject": "react-scripts eject",
"now-build": "yarn build",
"now-dev": "BROWSER=false react-scripts start",
"start": "react-scripts start",
"test": "react-scripts test"
},
@@ -20,6 +21,10 @@
"react-tippy": "^1.2.3",
"styled-components": "^4.3.2"
},
"devDependencies": {
"@testing-library/jest-dom": "^4.0.0",
"@testing-library/react": "^8.0.7"
},
"browserslist": {
"production": [
">0.2%",

View File

@@ -1,9 +1,8 @@
import React from 'react'
import ReactDOM from 'react-dom'
import { render } from '@testing-library/react'
import App from './App'
it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<App />, div)
ReactDOM.unmountComponentAtNode(div)
it('renders welcome message', () => {
const { getByText } = render(<App />)
expect(getByText('name new project')).toBeInTheDocument()
})

5
web/src/setupTests.js Normal file
View File

@@ -0,0 +1,5 @@
// react-testing-library renders your components to document.body,
// this will ensure they're removed after each test.
import '@testing-library/react/cleanup-after-each'
// this adds jest-dom's custom assertions
import '@testing-library/jest-dom/extend-expect'