Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

enzyme import & linter fixes #376

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -17,7 +15,7 @@ const MockApplication = ({ children }) => (
getOwnPropertyDescriptor: () => ({ configurable: true, enumerable: true }), // important for new checks in react-intl v5
})}
>
<ApplicationIntlContext.Provider value={mockIntl}>
<ApplicationIntlContext.Provider value={enzymeIntl.mockIntl}>
{children}
</ApplicationIntlContext.Provider>
</IntlProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
<DrawerMenu.WrappedComponent intl={mockIntl} />,
<DrawerMenu.WrappedComponent intl={enzymeIntl.mockIntl} />,
);

expect(shallowComponent).toMatchSnapshot();
Expand All @@ -15,7 +13,7 @@ describe('DrawerMenu', () => {
it('should render with function callbacks', () => {
const shallowComponent = enzyme.shallow(
<DrawerMenu.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
titleConfig={{
title: 'test-title',
}}
Expand Down Expand Up @@ -44,7 +42,7 @@ describe('DrawerMenu', () => {
it('should render with navigation and utility item ids', () => {
const shallowComponent = enzyme.shallow(
<DrawerMenu.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
titleConfig={{
title: 'test-title',
}}
Expand Down Expand Up @@ -74,7 +72,7 @@ describe('DrawerMenu', () => {
it('should render Help utility item when it is the only utility item present', () => {
const shallowComponent = enzyme.shallow(
<DrawerMenu.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
titleConfig={{
title: 'test-title',
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React from 'react';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import { mockIntl } from 'terra-enzyme-intl';
import ExtensionRollup from '../../../../../src/application-navigation/private/extensions/_ExtensionRollup';

describe('ExtensionRollup', () => {
it('should render default element', () => {
const shallowComponent = enzyme.shallow(
<ExtensionRollup.WrappedComponent intl={mockIntl} />,
<ExtensionRollup.WrappedComponent intl={enzymeIntl.mockIntl} />,
);

expect(shallowComponent).toMatchSnapshot();
Expand All @@ -15,7 +13,7 @@ describe('ExtensionRollup', () => {
it('should render prop data', () => {
const shallowComponent = enzyme.shallow(
<ExtensionRollup.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
hasChildNotifications
isPulsed
/>,
Expand All @@ -27,7 +25,7 @@ describe('ExtensionRollup', () => {
it('should render with ref', () => {
const shallowComponent = enzyme.shallow(
<ExtensionRollup.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
extensionRef={React.createRef()}
/>,
);
Expand All @@ -41,7 +39,7 @@ describe('ExtensionRollup', () => {

const shallowComponent = enzyme.shallow(
<ExtensionRollup.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
onSelect={mockCallBack}
/>,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
<Extensions.WrappedComponent intl={mockIntl} />,
<Extensions.WrappedComponent intl={enzymeIntl.mockIntl} />,
);

expect(shallowComponent).toMatchSnapshot();
Expand All @@ -15,7 +13,7 @@ describe('Extensions', () => {
it('should render prop data', () => {
const shallowComponent = enzyme.shallow(
<Extensions.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
activeBreakpoint="small"
extensionItems={[{ text: 'test-text', icon: <span>my icon</span>, key: 'my-test-key' }]}
notifications={{ myComponent: 3 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
<TabCount.WrappedComponent intl={mockIntl} />,
<TabCount.WrappedComponent intl={enzymeIntl.mockIntl} />,
);

expect(shallowComponent).toMatchSnapshot();
Expand All @@ -15,7 +13,7 @@ describe('TabCount', () => {
it('should render prop data', () => {
const shallowComponent = enzyme.shallow(
<TabCount.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
value={1}
isRollup
/>,
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
<TabRollup.WrappedComponent intl={mockIntl} />,
<TabRollup.WrappedComponent intl={enzymeIntl.mockIntl} />,
);

expect(shallowComponent).toMatchSnapshot();
Expand All @@ -22,7 +19,7 @@ describe('TabRollup', () => {
isPulsed
isSelected
hasCount
intl={mockIntl}
intl={enzymeIntl.mockIntl}
/>,
);

Expand All @@ -33,7 +30,7 @@ describe('TabRollup', () => {
const shallowComponent = enzyme.shallow(
<TabRollup.WrappedComponent
tabRef={React.createRef()}
intl={mockIntl}
intl={enzymeIntl.mockIntl}
/>,
);

Expand All @@ -47,7 +44,7 @@ describe('TabRollup', () => {
const shallowComponent = enzyme.shallow(
<TabRollup.WrappedComponent
onTabSelect={mockCallBack}
intl={mockIntl}
intl={enzymeIntl.mockIntl}
/>,
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { mockIntl } from 'terra-enzyme-intl';

import DisclosureContainer from '../../../src/disclosure-manager/_DisclosureContainer';

Expand All @@ -8,7 +7,7 @@ describe('DisclosureContainer', () => {
it('should render the provided children', () => {
const disclosureContainer = (
<DisclosureContainer.WrappedComponent
intl={mockIntl}
intl={enzymeIntl.mockIntl}
>
<div>Test Child</div>
</DisclosureContainer.WrappedComponent>
Expand Down
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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();

Expand Down
Loading