Skip to content

Commit

Permalink
Use @testing-library/preact
Browse files Browse the repository at this point in the history
I fail to use enzyme with declared preact/compat type:
preactjs/enzyme-adapter-preact-pure#105
  • Loading branch information
mu-hun committed May 5, 2020
1 parent 68bbe2d commit d2d61c4
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 262 deletions.
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ module.exports = {
'^react-dom/test-utils$': 'preact/test-utils',
'^react-dom$': 'preact/compat',
},
setupFilesAfterEnv: ['<rootDir>src/setupTests.ts'],
}
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,16 @@
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"@babel/preset-react": "^7.7.4",
"@testing-library/preact": "^1.0.2",
"@types/copy-webpack-plugin": "^5.0.0",
"@types/dotenv": "^8.2.0",
"@types/enzyme": "^3.10.5",
"@types/jest": "^25.1.3",
"babel-jest": "^25.5.1",
"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "^6.0.3",
"css-loader": "^3.4.0",
"dotenv": "^8.2.0",
"enzyme": "^3.11.0",
"enzyme-adapter-preact-pure": "^2.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-config-react": "^1.1.7",
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'preact'

import { mount } from 'enzyme'
import { render } from '@testing-library/preact'

jest.mock('./features/login')

Expand Down Expand Up @@ -32,7 +32,7 @@ describe('initial mounted login reducer', () => {
_dispatch = dispatch
return <main />
}
mount(<Comp />)
render(<Comp />)
})

test('Enter correct student account', async done => {
Expand Down
6 changes: 0 additions & 6 deletions src/setupTests.ts

This file was deleted.

Loading

0 comments on commit d2d61c4

Please sign in to comment.