Skip to content

Commit

Permalink
Update DEFAULT_CHART_CONTEXT constant mocks to `MOCK_DEFAULT_CHART_…
Browse files Browse the repository at this point in the history
…CONTEXT`
  • Loading branch information
philschoefer committed Nov 28, 2024
1 parent ae886e0 commit 3e74b24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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},
})),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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},
})),
}));
Expand Down

0 comments on commit 3e74b24

Please sign in to comment.