Skip to content

Commit 49abf84

Browse files
committed
Convert blueprint tests to RTL
1 parent c104e82 commit 49abf84

File tree

9 files changed

+219
-505
lines changed

9 files changed

+219
-505
lines changed

packages/blueprint-component-mapper/config/jest.setup.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/blueprint-component-mapper/src/tests/checkbox.test.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { mount } from 'enzyme';
2+
import { render, screen } from '@testing-library/react';
33

44
import { FormRenderer, componentTypes } from '@data-driven-forms/react-form-renderer';
55

@@ -28,13 +28,12 @@ describe('<Checkbox />', () => {
2828
],
2929
};
3030

31-
const wrapper = mount(
31+
render(
3232
<FormRenderer onSubmit={jest.fn()} FormTemplate={(props) => <FormTemplate {...props} />} schema={schema} componentMapper={componentMapper} />
3333
);
3434

35-
expect(wrapper.find(Checkbox)).toHaveLength(2);
36-
expect(wrapper.find(Checkbox).first().props().label).toEqual('option 1');
37-
expect(wrapper.find(Checkbox).last().props().label).toEqual('option 2');
35+
expect(screen.getByText('option 1')).toBeInTheDocument();
36+
expect(screen.getByText('option 2')).toBeInTheDocument();
3837
});
3938

4039
it('renders multiple required checkbox', () => {
@@ -59,10 +58,10 @@ describe('<Checkbox />', () => {
5958
],
6059
};
6160

62-
const wrapper = mount(
61+
render(
6362
<FormRenderer onSubmit={jest.fn()} FormTemplate={(props) => <FormTemplate {...props} />} schema={schema} componentMapper={componentMapper} />
6463
);
6564

66-
expect(wrapper.find('.bp3-text-muted').last().text()).toEqual('(required)');
65+
expect(screen.getByText('(required)')).toBeInTheDocument();
6766
});
6867
});

0 commit comments

Comments
 (0)