From 113c831b1aaf2587e2d0fd83524a70eea4a12572 Mon Sep 17 00:00:00 2001 From: Kyle Durand Date: Wed, 25 Aug 2021 18:49:21 -0400 Subject: [PATCH 1/3] [OptionList] Modernize tests --- .../Checkbox/tests/Checkbox.test.tsx | 14 +- .../components/Option/tests/Option.test.tsx | 42 +++--- .../OptionList/tests/OptionList.test.tsx | 141 ++++++++---------- 3 files changed, 87 insertions(+), 110 deletions(-) diff --git a/src/components/OptionList/components/Checkbox/tests/Checkbox.test.tsx b/src/components/OptionList/components/Checkbox/tests/Checkbox.test.tsx index c3c60f64176..a7144d4c0b7 100644 --- a/src/components/OptionList/components/Checkbox/tests/Checkbox.test.tsx +++ b/src/components/OptionList/components/Checkbox/tests/Checkbox.test.tsx @@ -1,6 +1,4 @@ import React from 'react'; -// eslint-disable-next-line no-restricted-imports -import {mountWithAppProvider} from 'test-utilities/legacy'; import {mountWithApp} from 'test-utilities'; import {Key} from '../../../../../types'; @@ -17,9 +15,7 @@ describe('', () => { }; it('sets pass through props for input', () => { - const input = mountWithAppProvider().find( - 'input', - ); + const input = mountWithApp().find('input')!; const {checked, disabled, id, name, value} = defaultProps; expect(input.prop('checked')).toBe(checked); @@ -32,9 +28,11 @@ describe('', () => { it('calls onChange', () => { const spy = jest.fn(); - mountWithAppProvider() - .find('input') - .simulate('change'); + const input = mountWithApp( + , + ).find('input'); + + input!.trigger('onChange'); expect(spy).toHaveBeenCalledTimes(1); }); diff --git a/src/components/OptionList/components/Option/tests/Option.test.tsx b/src/components/OptionList/components/Option/tests/Option.test.tsx index a4cb5a49d63..fb92c8fafbb 100644 --- a/src/components/OptionList/components/Option/tests/Option.test.tsx +++ b/src/components/OptionList/components/Option/tests/Option.test.tsx @@ -1,6 +1,4 @@ import React from 'react'; -// eslint-disable-next-line no-restricted-imports -import {mountWithAppProvider} from 'test-utilities/legacy'; import {mountWithApp} from 'test-utilities'; import {Checkbox} from '../../Checkbox'; @@ -18,27 +16,23 @@ describe('