mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 01:59:08 +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
|
@ -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": "*"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue