Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Apr 20, 2023
1 parent 75a15ba commit 4ed494d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ const defaultFilters = [

const renderMenu = ({
formData = defaultFormData,
filters = defaultFilters,
drillByConfig = { filters: defaultFilters, groupbyFieldName: 'groupby' },
...rest
}: Partial<DrillByMenuItemsProps>) =>
render(
<Menu>
<DrillByMenuItems
formData={formData ?? defaultFormData}
filters={filters}
groupbyFieldName="groupby"
drillByConfig={drillByConfig}
{...rest}
/>
</Menu>,
Expand Down Expand Up @@ -133,7 +132,7 @@ test('render disabled menu item for unsupported chart', async () => {
});

test('render disabled menu item for supported chart, no filters', async () => {
renderMenu({ filters: [] });
renderMenu({ drillByConfig: { filters: [], groupbyFieldName: 'groupby' } });
await expectDrillByDisabled('Drill by is not available for this data point');
});

Expand Down Expand Up @@ -237,6 +236,6 @@ test('When menu item is clicked, call onSelection with clicked column and drill
column_name: 'col1',
groupby: true,
},
defaultFilters,
{ filters: defaultFilters, groupbyFieldName: 'groupby' },
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const renderModal = async (modalProps: Partial<DrillByModalProps> = {}) => {
formData={formData}
onHideModal={() => setShowModal(false)}
dataset={dataset}
drillByConfig={{ groupbyFieldName: 'groupby', filters: [] }}
{...modalProps}
/>
)}
Expand Down Expand Up @@ -148,7 +149,10 @@ test('should render alert banner when results fail to load', async () => {
test('should generate Explore url', async () => {
await renderModal({
column: { column_name: 'name' },
filters: [{ col: 'gender', op: '==', val: 'boy' }],
drillByConfig: {
filters: [{ col: 'gender', op: '==', val: 'boy' }],
groupbyFieldName: 'groupby',
},
});
await waitFor(() => fetchMock.called(CHART_DATA_ENDPOINT));
const expectedRequestPayload = {
Expand Down Expand Up @@ -208,7 +212,10 @@ test('should render radio buttons', async () => {
test('render breadcrumbs', async () => {
await renderModal({
column: { column_name: 'name' },
filters: [{ col: 'gender', op: '==', val: 'boy' }],
drillByConfig: {
filters: [{ col: 'gender', op: '==', val: 'boy' }],
groupbyFieldName: 'groupby',
},
});

const breadcrumbItems = screen.getAllByTestId('drill-by-breadcrumb-item');
Expand Down

0 comments on commit 4ed494d

Please sign in to comment.