diff --git a/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx b/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx index dfae4cfb2..0b09d3871 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx @@ -6,11 +6,11 @@ import { mockDefaultTheme, } from '../../../test-utilities/mountWithProvider'; import {Shimmer} from '../components'; -import {DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; +import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; jest.mock('@shopify/polaris-viz-core/src/hooks/useChartContext', () => ({ useChartContext: jest.fn(() => ({ - ...DEFAULT_CHART_CONTEXT, + ...MOCK_DEFAULT_CHART_CONTEXT, containerBounds: {height: 400, width: 800, x: 0, y: 0}, })), })); diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx index a43d10414..93c6316b6 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx @@ -19,7 +19,8 @@ import { } from '../components'; import {normalizeData} from '../../../utilities'; import {TooltipWrapper} from '../../TooltipWrapper'; -import {DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; +// jest will not allow access to out of scope constants if they are not named `MOCK_` +import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; jest.mock('../../Labels/utilities/getWidestLabel', () => { return { @@ -37,7 +38,7 @@ jest.mock('@shopify/polaris-viz-core/src/utilities', () => ({ jest.mock('@shopify/polaris-viz-core/src/hooks/useChartContext', () => ({ useChartContext: jest.fn(() => ({ - ...DEFAULT_CHART_CONTEXT, + ...MOCK_DEFAULT_CHART_CONTEXT, containerBounds: {height: 300, width: 100}, })), }));