diff --git a/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx b/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx index 4aa18b55929..6d605a639b1 100644 --- a/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx +++ b/superset-frontend/packages/superset-ui-core/src/components/Collapse/CollapseLabelInModal.tsx @@ -48,15 +48,9 @@ export const CollapseLabelInModal: React.FC = ({ {title}{' '} {validateCheckStatus !== undefined && (validateCheckStatus ? ( - + ) : ( - + ))} { const name = fileName.replace(/_/g, '-'); // Replace underscores with dashes - const words = name.split(/(?=[A-Z])/); // Split at uppercase letters + const words = name.split(/(?<=[a-z])(?=[A-Z])/); // Split at lowercase-to-uppercase transitions if (words.length === 2) { return words[0].toLowerCase(); diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx index deb8e1b6fe7..dbd7eef47ce 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx @@ -23,7 +23,6 @@ import { userEvent, within, } from 'spec/helpers/testing-library'; -import { VizType } from '@superset-ui/core'; import { buildErrorTooltipMessage } from './buildErrorTooltipMessage'; import AlertReportModal, { AlertReportModalProps } from './AlertReportModal'; import { AlertObject, NotificationMethodOption } from './types'; @@ -49,6 +48,7 @@ const generateMockPayload = (dashboard = true) => { database: { database_name: 'examples', id: 1, + value: 1, }, description: 'Some description', extra: {}, @@ -93,8 +93,9 @@ const generateMockPayload = (dashboard = true) => { ...mockPayload, chart: { id: 1, - slice_name: 'Test Chart', - viz_type: VizType.Table, + slice_name: 'test chart', + viz_type: 'table', + value: 1, }, }; }; @@ -134,7 +135,7 @@ const validAlert: AlertObject = { creation_method: 'alerts_reports', crontab: '0 0 * * *', dashboard_id: 0, - chart_id: 0, + chart_id: 1, force_screenshot: false, last_state: 'Not triggered', name: 'Test Alert', @@ -153,6 +154,24 @@ const validAlert: AlertObject = { ], timezone: 'America/Rainy_River', type: 'Alert', + database: { + id: 1, + value: 1, + database_name: 'test_db', + } as any, + sql: 'SELECT COUNT(*) FROM test_table', + validator_config_json: { + op: '>', + threshold: 10.0, + }, + working_timeout: 3600, + chart: { + id: 1, + value: 1, + label: 'Test Chart', + slice_name: 'Test Chart', + viz_type: 'table', + } as any, }; jest.mock('./buildErrorTooltipMessage', () => ({ @@ -258,6 +277,10 @@ test('renders 5 checkmarks for a valid alert', async () => { render(, { useRedux: true, }); + + // Wait for validation to complete by waiting for the modal to fully render + await screen.findByText('Edit alert'); + const checkmarks = await screen.findAllByRole('img', { name: /check-circle/i, });