mirror of
https://github.com/uetchy/namae.git
synced 2025-08-20 09:58:13 +09:00
test: setup
This commit is contained in:
@@ -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
5
web/src/setupTests.js
Normal 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'
|
Reference in New Issue
Block a user