diff --git a/test/common/SimplePaginator.test.tsx b/test/common/SimplePaginator.test.tsx
index 128221d9..7b2c060a 100644
--- a/test/common/SimplePaginator.test.tsx
+++ b/test/common/SimplePaginator.test.tsx
@@ -9,7 +9,7 @@ describe('', () => {
it.each([-3, -2, 0, 1])('renders empty when the amount of pages is smaller than 2', (pagesCount) => {
const { container } = setUp(pagesCount);
- expect(container.firstChild).toEqual(null);
+ expect(container.firstChild).toBeNull();
});
describe('ELLIPSIS are rendered where expected', () => {
diff --git a/test/servers/reducers/selectedServer.test.ts b/test/servers/reducers/selectedServer.test.ts
index f50a12ac..2074bcd3 100644
--- a/test/servers/reducers/selectedServer.test.ts
+++ b/test/servers/reducers/selectedServer.test.ts
@@ -14,7 +14,7 @@ import { NonReachableServer, NotFoundServer, RegularServer } from '../../../src/
describe('selectedServerReducer', () => {
describe('reducer', () => {
it('returns default when action is RESET_SELECTED_SERVER', () =>
- expect(reducer(null, { type: RESET_SELECTED_SERVER, selectedServer: null })).toEqual(null));
+ expect(reducer(null, { type: RESET_SELECTED_SERVER, selectedServer: null })).toBeNull());
it('returns selected server when action is SELECT_SERVER', () => {
const selectedServer = Mock.of({ id: 'abc123' });
diff --git a/test/utils/table/TableOrderIcon.test.tsx b/test/utils/table/TableOrderIcon.test.tsx
index 8a4f72c9..03bc25e5 100644
--- a/test/utils/table/TableOrderIcon.test.tsx
+++ b/test/utils/table/TableOrderIcon.test.tsx
@@ -1,38 +1,29 @@
-import { shallow, ShallowWrapper } from 'enzyme';
-import { faCaretDown as caretDownIcon, faCaretUp as caretUpIcon } from '@fortawesome/free-solid-svg-icons';
+import { render } from '@testing-library/react';
import { TableOrderIcon } from '../../../src/utils/table/TableOrderIcon';
import { OrderDir } from '../../../src/utils/helpers/ordering';
describe('', () => {
- let wrapper: ShallowWrapper;
- const createWrapper = (field: string, currentDir?: OrderDir, className?: string) => {
- wrapper = shallow(
- ,
- );
-
- return wrapper;
- };
-
- afterEach(() => wrapper?.unmount());
+ const setUp = (field: string, currentDir?: OrderDir, className?: string) => render(
+ ,
+ );
it.each([
['foo', undefined],
['bar', 'DESC' as OrderDir],
['bar', 'ASC' as OrderDir],
])('renders empty when not all conditions are met', (field, dir) => {
- const wrapper = createWrapper(field, dir);
-
- expect(wrapper.html()).toEqual(null);
+ const { container } = setUp(field, dir);
+ expect(container.firstChild).toBeNull();
});
it.each([
- ['DESC' as OrderDir, caretDownIcon],
- ['ASC' as OrderDir, caretUpIcon],
- ])('renders an icon when all conditions are met', (dir, expectedIcon) => {
- const wrapper = createWrapper('foo', dir);
+ ['DESC' as OrderDir],
+ ['ASC' as OrderDir],
+ ])('renders an icon when all conditions are met', (dir) => {
+ const { container } = setUp('foo', dir);
- expect(wrapper.html()).not.toEqual(null);
- expect(wrapper.prop('icon')).toEqual(expectedIcon);
+ expect(container.firstChild).not.toBeNull();
+ expect(container.firstChild).toMatchSnapshot();
});
it.each([
@@ -40,8 +31,7 @@ describe('', () => {
['foo', 'foo'],
['bar', 'bar'],
])('renders expected classname', (className, expectedClassName) => {
- const wrapper = createWrapper('foo', 'ASC', className);
-
- expect(wrapper.prop('className')).toEqual(expectedClassName);
+ const { container } = setUp('foo', 'ASC', className);
+ expect(container.firstChild).toHaveClass(expectedClassName);
});
});
diff --git a/test/utils/table/__snapshots__/TableOrderIcon.test.tsx.snap b/test/utils/table/__snapshots__/TableOrderIcon.test.tsx.snap
new file mode 100644
index 00000000..ba31f4f9
--- /dev/null
+++ b/test/utils/table/__snapshots__/TableOrderIcon.test.tsx.snap
@@ -0,0 +1,37 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` renders an icon when all conditions are met 1`] = `
+
+`;
+
+exports[` renders an icon when all conditions are met 2`] = `
+
+`;