mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 17:49:09 +00:00
fix tests, divorce enzyme where-ever possible
This commit is contained in:
parent
3c3af304f7
commit
2fb721078e
9 changed files with 106 additions and 907 deletions
|
@ -42,10 +42,14 @@
|
|||
"@types/react-dom": "^17.0.11",
|
||||
"@types/react-helmet": "^6.1.5",
|
||||
"@types/styled-components": "^5.1.21",
|
||||
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
|
||||
"babel-loader": "^8.2.3",
|
||||
"babel-plugin-styled-components": "^2.0.2",
|
||||
"change-case": "^4.1.2",
|
||||
"tslint": "^6.1.3",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.6",
|
||||
"jest": "^27.4.7",
|
||||
"jest-styled-components": "^7.0.8",
|
||||
"typescript": "^4.5.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { render } from '@testing-library/react';
|
||||
import * as React from 'react';
|
||||
import { ReactifyNewlines } from './ReactifyNewlines';
|
||||
|
||||
it('renders a correct number of divs per newlines', () => {
|
||||
const view = shallow(<ReactifyNewlines>{`1\n2\n3`}</ReactifyNewlines>);
|
||||
it('renders a correct number of divs per newlines', async () => {
|
||||
const view = render(<ReactifyNewlines>{`test\ntest\ntest`}</ReactifyNewlines>);
|
||||
|
||||
expect(view.find('div').length).toBe(3);
|
||||
const elements = await view.findAllByText('test');
|
||||
expect(elements.length).toBe(3);
|
||||
});
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
module.exports = {
|
||||
name: 'web',
|
||||
preset: 'ts-jest/presets/js-with-ts',
|
||||
testEnvironment: 'jsdom',
|
||||
reporters: ['default'],
|
||||
setupFilesAfterEnv: ['jest-styled-components', '../../hack/jestSetup.ts'],
|
||||
snapshotSerializers: ['enzyme-to-json/serializer'],
|
||||
setupFilesAfterEnv: ['../../hack/jestSetup.ts'],
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: '../../tsconfig.test.json',
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"@roleypoly/types": "*"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"enzyme": "3.x",
|
||||
"@testing-library/react": "^12.1.2",
|
||||
"react": "*"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,7 @@ module.exports = {
|
|||
name: 'web',
|
||||
preset: 'ts-jest/presets/js-with-ts',
|
||||
testEnvironment: 'jsdom',
|
||||
reporters: ['default'],
|
||||
setupFilesAfterEnv: ['jest-styled-components', '../../hack/jestSetup.ts'],
|
||||
snapshotSerializers: ['enzyme-to-json/serializer'],
|
||||
setupFilesAfterEnv: ['../../hack/jestSetup.ts'],
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
tsconfig: '../../tsconfig.test.json',
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
"@types/react-helmet": "^6.1.5",
|
||||
"babel-loader": "8.2.3",
|
||||
"cross-env": "7.0.3",
|
||||
"jest": "^27.4.7",
|
||||
"ts-loader": "^9.2.6",
|
||||
"webpack": "5.67.0"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue