From 5f9ef58a2d1dba79b0921b509a0a4db84c6f6593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karen=20Pinz=C3=A1s=20Morrongiello?= <45268098+kpinzas-sh@users.noreply.github.com> Date: Tue, 20 Jul 2021 22:16:57 -0400 Subject: [PATCH 1/2] Add test modernization to Truncate and UnstyledButton --- .../Truncate/tests/Truncate.test.tsx | 7 +- .../tests/UnstyledButton.test.tsx | 308 ++++++++++-------- 2 files changed, 175 insertions(+), 140 deletions(-) diff --git a/src/components/Truncate/tests/Truncate.test.tsx b/src/components/Truncate/tests/Truncate.test.tsx index 586c6c29caa..3c5ba54bd2b 100644 --- a/src/components/Truncate/tests/Truncate.test.tsx +++ b/src/components/Truncate/tests/Truncate.test.tsx @@ -1,12 +1,11 @@ import React from 'react'; -// eslint-disable-next-line no-restricted-imports -import {mountWithAppProvider} from 'test-utilities/legacy'; +import {mountWithApp} from 'test-utilities'; import {Truncate} from '../Truncate'; describe('', () => { it('renders its children', () => { - const truncate = mountWithAppProvider(Long text); - expect(truncate.contains('Long text')).toBe(true); + const truncate = mountWithApp(Long text); + expect(truncate).toContainReactText('Long text'); }); }); diff --git a/src/components/UnstyledButton/tests/UnstyledButton.test.tsx b/src/components/UnstyledButton/tests/UnstyledButton.test.tsx index f9fa1bf8b55..15484590bf3 100644 --- a/src/components/UnstyledButton/tests/UnstyledButton.test.tsx +++ b/src/components/UnstyledButton/tests/UnstyledButton.test.tsx @@ -1,6 +1,5 @@ import React from 'react'; -// eslint-disable-next-line no-restricted-imports -import {mountWithAppProvider, trigger} from 'test-utilities/legacy'; +import {mountWithApp} from 'test-utilities'; import {UnstyledLink} from 'components'; import {UnstyledButton} from '../UnstyledButton'; @@ -11,33 +10,31 @@ describe('