Skip to content

Commit 4340cf6

Browse files
authored
test(Breadcrumbs): rewrite test using react-testing-library (#820)
[ci skip]
1 parent 74e4a00 commit 4340cf6

File tree

2 files changed

+254
-202
lines changed

2 files changed

+254
-202
lines changed

packages/main/src/components/Breadcrumbs/Breadcrumbs.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createPassThroughPropsTest } from '@shared/tests/utils';
2-
import { mount } from 'enzyme';
2+
import { render } from '@shared/tests';
33
import { Breadcrumbs } from '@ui5/webcomponents-react/lib/Breadcrumbs';
44
import { BreadcrumbsSeparatorStyle } from '@ui5/webcomponents-react/lib/BreadcrumbsSeparatorStyle';
55
import { Link } from '@ui5/webcomponents-react/lib/Link';
@@ -8,26 +8,26 @@ import React from 'react';
88
describe('Breadcrumbs', () => {
99
Object.values(BreadcrumbsSeparatorStyle).forEach((style) => {
1010
test(`separatorStyle: '${style}'`, () => {
11-
const wrapper = mount(
11+
const { asFragment } = render(
1212
<Breadcrumbs separatorStyle={style}>
1313
<Link>Link 1</Link>
1414
<Link>Link 2</Link>
1515
<Link>Link 3</Link>
1616
</Breadcrumbs>
1717
);
18-
expect(wrapper.render()).toMatchSnapshot();
18+
expect(asFragment()).toMatchSnapshot();
1919
});
2020
});
2121

2222
test('with currentLocationText', () => {
23-
const wrapper = mount(
23+
const { asFragment } = render(
2424
<Breadcrumbs currentLocationText="Current Location">
2525
<Link>Link 1</Link>
2626
<Link>Link 2</Link>
2727
<Link>Link 3</Link>
2828
</Breadcrumbs>
2929
);
30-
expect(wrapper.render()).toMatchSnapshot();
30+
expect(asFragment()).toMatchSnapshot();
3131
});
3232

3333
createPassThroughPropsTest(Breadcrumbs);

0 commit comments

Comments
 (0)