Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jan 18, 2025
1 parent 2d8716e commit c5c85ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 33 deletions.
4 changes: 1 addition & 3 deletions superset-frontend/src/components/Alert/Alert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ test('renders with default props', async () => {
render(<Alert message="Message" />);

expect(screen.getByRole('alert')).toHaveTextContent('Message');
expect(
await screen.getByRole('img', { name: 'info-circle' }),
).toBeInTheDocument();
expect(screen.getByRole('img', { name: 'info-circle' })).toBeInTheDocument();
});

test('renders message for each alert type', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ test('should show missing params state', () => {
expect(screen.getByText(/missing url parameters/i)).toBeVisible();
expect(
screen.getByText(
/the url is missing the dataset_id or slice_id parameters\./i,
/the url is missing the dataset_id or slice_id parameters/i,
),
).toBeVisible();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,43 +431,29 @@ class DatasourceControl extends PureComponent {
<div className="error-alert">
<ErrorAlert
level="warning"
title={t('Missing URL parameters')}
source="explore"
subtitle={
<>
<p>
{t(
'The URL is missing the dataset_id or slice_id parameters.',
)}
</p>
</>
}
errorType={t('Missing URL parameters')}
description={t(
'The URL is missing the dataset_id or slice_id parameters.',
)}
/>
</div>
)}
{isMissingDatasource && !isMissingParams && (
<div className="error-alert">
<ErrorAlert
level="warning"
title={t('Missing dataset')}
source="explore"
subtitle={
errorType={t('Missing dataset')}
description={
<>
<p>
{t(
'The dataset linked to this chart may have been deleted.',
)}
</p>
<p>
<Button
buttonStyle="primary"
onClick={() =>
this.handleMenuItemClick({ key: CHANGE_DATASET })
}
>
{t('Swap dataset')}
</Button>
</p>
{t('The dataset linked to this chart may have been deleted.')}
<Button
buttonStyle="primary"
onClick={() =>
this.handleMenuItemClick({ key: CHANGE_DATASET })
}
>
{t('Swap dataset')}
</Button>
</>
}
/>
Expand Down

0 comments on commit c5c85ea

Please sign in to comment.