From 5a55dc115f8211c44015349881d263d82243c8d8 Mon Sep 17 00:00:00 2001 From: Saad Adnan <38024451+sdadn@users.noreply.github.com> Date: Wed, 24 Apr 2024 12:43:12 -0500 Subject: [PATCH] enzyme import & linter fixes (#376) --- .../private/ApplicationNavigation.test.jsx | 4 +--- .../private/drawer-menu/DrawerMenu.test.jsx | 10 ++++------ .../private/extensions/ExtensionRollup.test.jsx | 10 ++++------ .../private/extensions/Extensions.test.jsx | 6 ++---- .../private/tabs/TabCount.test.jsx | 6 ++---- .../private/tabs/TabRollup.test.jsx | 11 ++++------- .../disclosure-manager/DisclosureContainer.test.jsx | 3 +-- .../getUnsavedChangesPromptOptions.test.jsx | 6 ++---- 8 files changed, 20 insertions(+), 36 deletions(-) diff --git a/packages/terra-application/tests/jest/application-navigation/private/ApplicationNavigation.test.jsx b/packages/terra-application/tests/jest/application-navigation/private/ApplicationNavigation.test.jsx index e3f32d92a..e1e235635 100644 --- a/packages/terra-application/tests/jest/application-navigation/private/ApplicationNavigation.test.jsx +++ b/packages/terra-application/tests/jest/application-navigation/private/ApplicationNavigation.test.jsx @@ -2,8 +2,6 @@ import React from 'react'; import { ActiveBreakpointContext } from 'terra-breakpoints'; import ThemeContextProvider from 'terra-theme-context/lib/ThemeContextProvider'; import { IntlProvider } from 'react-intl'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ -import { mountWithIntl, mockIntl } from 'terra-enzyme-intl'; import { ApplicationIntlContext } from '../../../../src/application-intl'; import ApplicationNavigation from '../../../../src/application-navigation/private/ApplicationNavigation'; @@ -17,7 +15,7 @@ const MockApplication = ({ children }) => ( getOwnPropertyDescriptor: () => ({ configurable: true, enumerable: true }), // important for new checks in react-intl v5 })} > - + {children} diff --git a/packages/terra-application/tests/jest/application-navigation/private/drawer-menu/DrawerMenu.test.jsx b/packages/terra-application/tests/jest/application-navigation/private/drawer-menu/DrawerMenu.test.jsx index 80f45a241..cde781e48 100644 --- a/packages/terra-application/tests/jest/application-navigation/private/drawer-menu/DrawerMenu.test.jsx +++ b/packages/terra-application/tests/jest/application-navigation/private/drawer-menu/DrawerMenu.test.jsx @@ -1,12 +1,10 @@ import React from 'react'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ -import { mockIntl } from 'terra-enzyme-intl'; import DrawerMenu from '../../../../../src/application-navigation/private/drawer-menu/_DrawerMenu'; describe('DrawerMenu', () => { it('should render default element', () => { const shallowComponent = enzyme.shallow( - , + , ); expect(shallowComponent).toMatchSnapshot(); @@ -15,7 +13,7 @@ describe('DrawerMenu', () => { it('should render with function callbacks', () => { const shallowComponent = enzyme.shallow( { it('should render with navigation and utility item ids', () => { const shallowComponent = enzyme.shallow( { it('should render Help utility item when it is the only utility item present', () => { const shallowComponent = enzyme.shallow( { it('should render default element', () => { const shallowComponent = enzyme.shallow( - , + , ); expect(shallowComponent).toMatchSnapshot(); @@ -15,7 +13,7 @@ describe('ExtensionRollup', () => { it('should render prop data', () => { const shallowComponent = enzyme.shallow( , @@ -27,7 +25,7 @@ describe('ExtensionRollup', () => { it('should render with ref', () => { const shallowComponent = enzyme.shallow( , ); @@ -41,7 +39,7 @@ describe('ExtensionRollup', () => { const shallowComponent = enzyme.shallow( , ); diff --git a/packages/terra-application/tests/jest/application-navigation/private/extensions/Extensions.test.jsx b/packages/terra-application/tests/jest/application-navigation/private/extensions/Extensions.test.jsx index ed195d881..69ab623d8 100644 --- a/packages/terra-application/tests/jest/application-navigation/private/extensions/Extensions.test.jsx +++ b/packages/terra-application/tests/jest/application-navigation/private/extensions/Extensions.test.jsx @@ -1,12 +1,10 @@ import React from 'react'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ -import { mockIntl } from 'terra-enzyme-intl'; import Extensions from '../../../../../src/application-navigation/private/extensions/_Extensions'; describe('Extensions', () => { it('should render default element', () => { const shallowComponent = enzyme.shallow( - , + , ); expect(shallowComponent).toMatchSnapshot(); @@ -15,7 +13,7 @@ describe('Extensions', () => { it('should render prop data', () => { const shallowComponent = enzyme.shallow( my icon, key: 'my-test-key' }]} notifications={{ myComponent: 3 }} diff --git a/packages/terra-application/tests/jest/application-navigation/private/tabs/TabCount.test.jsx b/packages/terra-application/tests/jest/application-navigation/private/tabs/TabCount.test.jsx index 627bcd23c..1305938ad 100644 --- a/packages/terra-application/tests/jest/application-navigation/private/tabs/TabCount.test.jsx +++ b/packages/terra-application/tests/jest/application-navigation/private/tabs/TabCount.test.jsx @@ -1,12 +1,10 @@ import React from 'react'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ -import { mockIntl } from 'terra-enzyme-intl'; import TabCount from '../../../../../src/application-navigation/private/tabs/_TabCount'; describe('TabCount', () => { it('should render default element', () => { const shallowComponent = enzyme.shallow( - , + , ); expect(shallowComponent).toMatchSnapshot(); @@ -15,7 +13,7 @@ describe('TabCount', () => { it('should render prop data', () => { const shallowComponent = enzyme.shallow( , diff --git a/packages/terra-application/tests/jest/application-navigation/private/tabs/TabRollup.test.jsx b/packages/terra-application/tests/jest/application-navigation/private/tabs/TabRollup.test.jsx index 40561e06e..9e84c13bc 100644 --- a/packages/terra-application/tests/jest/application-navigation/private/tabs/TabRollup.test.jsx +++ b/packages/terra-application/tests/jest/application-navigation/private/tabs/TabRollup.test.jsx @@ -1,13 +1,10 @@ import React from 'react'; -/* eslint-disable-next-line import/no-extraneous-dependencies */ -import { mockIntl } from 'terra-enzyme-intl'; - import TabRollup from '../../../../../src/application-navigation/private/tabs/_TabRollup'; describe('TabRollup', () => { it('should render default element', () => { const shallowComponent = enzyme.shallow( - , + , ); expect(shallowComponent).toMatchSnapshot(); @@ -22,7 +19,7 @@ describe('TabRollup', () => { isPulsed isSelected hasCount - intl={mockIntl} + intl={enzymeIntl.mockIntl} />, ); @@ -33,7 +30,7 @@ describe('TabRollup', () => { const shallowComponent = enzyme.shallow( , ); @@ -47,7 +44,7 @@ describe('TabRollup', () => { const shallowComponent = enzyme.shallow( , ); diff --git a/packages/terra-application/tests/jest/disclosure-manager/DisclosureContainer.test.jsx b/packages/terra-application/tests/jest/disclosure-manager/DisclosureContainer.test.jsx index 752e70010..ccdd84cbe 100644 --- a/packages/terra-application/tests/jest/disclosure-manager/DisclosureContainer.test.jsx +++ b/packages/terra-application/tests/jest/disclosure-manager/DisclosureContainer.test.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import { mockIntl } from 'terra-enzyme-intl'; import DisclosureContainer from '../../../src/disclosure-manager/_DisclosureContainer'; @@ -8,7 +7,7 @@ describe('DisclosureContainer', () => { it('should render the provided children', () => { const disclosureContainer = (
Test Child
diff --git a/packages/terra-application/tests/jest/navigation-prompt/getUnsavedChangesPromptOptions.test.jsx b/packages/terra-application/tests/jest/navigation-prompt/getUnsavedChangesPromptOptions.test.jsx index 1a3315e83..4a2a30569 100644 --- a/packages/terra-application/tests/jest/navigation-prompt/getUnsavedChangesPromptOptions.test.jsx +++ b/packages/terra-application/tests/jest/navigation-prompt/getUnsavedChangesPromptOptions.test.jsx @@ -1,10 +1,8 @@ -import { mockIntl } from 'terra-enzyme-intl'; - import getUnsavedChangesPromptOptions from '../../../src/navigation-prompt/getUnsavedChangesPromptOptions'; describe('getUnsavedChangesPromptOptions', () => { it('generates a function that provides appropriate messaging for a single prompt', () => { - const generatedFunction = getUnsavedChangesPromptOptions(mockIntl); + const generatedFunction = getUnsavedChangesPromptOptions(enzymeIntl.mockIntl); expect(generatedFunction).toBeDefined(); @@ -14,7 +12,7 @@ describe('getUnsavedChangesPromptOptions', () => { }); it('generates a function that provides appropriate messaging for multiple prompts', () => { - const generatedFunction = getUnsavedChangesPromptOptions(mockIntl); + const generatedFunction = getUnsavedChangesPromptOptions(enzymeIntl.mockIntl); expect(generatedFunction).toBeDefined();