mirror of
https://github.com/apache/superset.git
synced 2026-05-31 21:29:19 +00:00
chore(deps-dev): bump fetch-mock from 11.1.5 to 12.6.0 in /superset-frontend/packages/superset-ui-core (#36662)
Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: hainenber <dotronghai96@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Evan Rusackas <evan@rusackas.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ const chartDataEndpoint = 'glob:*/api/v1/chart/data*';
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
fetchMock.restore();
|
||||
fetchMock.clearHistory().removeRoutes();
|
||||
});
|
||||
|
||||
test('renders Alert component when query result contains validation error', async () => {
|
||||
@@ -40,14 +40,18 @@ test('renders Alert component when query result contains validation error', asyn
|
||||
* component instead of showing a blank panel
|
||||
*/
|
||||
// Mock API response with validation error
|
||||
fetchMock.post(chartDataEndpoint, {
|
||||
result: [
|
||||
{
|
||||
error: 'Missing temporal column',
|
||||
language: 'sql',
|
||||
},
|
||||
],
|
||||
});
|
||||
fetchMock.post(
|
||||
chartDataEndpoint,
|
||||
{
|
||||
result: [
|
||||
{
|
||||
error: 'Missing temporal column',
|
||||
language: 'sql',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ name: chartDataEndpoint },
|
||||
);
|
||||
|
||||
render(<ViewQueryModal latestQueryFormData={mockFormData} />, {
|
||||
useRedux: true,
|
||||
@@ -55,7 +59,7 @@ test('renders Alert component when query result contains validation error', asyn
|
||||
|
||||
// Wait for API call to complete
|
||||
await waitFor(() =>
|
||||
expect(fetchMock.calls(chartDataEndpoint)).toHaveLength(1),
|
||||
expect(fetchMock.callHistory.calls(chartDataEndpoint)).toHaveLength(1),
|
||||
);
|
||||
|
||||
// Assert Alert component is rendered with error message
|
||||
@@ -73,15 +77,19 @@ test('renders both Alert and SQL query when parsing error occurs', async () => {
|
||||
* For parsing errors, the SQL was successfully compiled but optimization failed.
|
||||
*/
|
||||
// Mock API response with parsing error (has both query and error)
|
||||
fetchMock.post(chartDataEndpoint, {
|
||||
result: [
|
||||
{
|
||||
query: 'SELECT SUM ( Open',
|
||||
error: "Error parsing near 'Open' at line 1:17",
|
||||
language: 'sql',
|
||||
},
|
||||
],
|
||||
});
|
||||
fetchMock.post(
|
||||
chartDataEndpoint,
|
||||
{
|
||||
result: [
|
||||
{
|
||||
query: 'SELECT SUM ( Open',
|
||||
error: "Error parsing near 'Open' at line 1:17",
|
||||
language: 'sql',
|
||||
},
|
||||
],
|
||||
},
|
||||
{ name: chartDataEndpoint },
|
||||
);
|
||||
|
||||
render(<ViewQueryModal latestQueryFormData={mockFormData} />, {
|
||||
useRedux: true,
|
||||
@@ -100,9 +108,12 @@ test('renders both Alert and SQL query when parsing error occurs', async () => {
|
||||
// Assert SQL query is also displayed
|
||||
// Note: The SQL is rendered inside a syntax-highlighted code block where
|
||||
// each keyword is in a separate span element
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('SELECT')).toBeInTheDocument();
|
||||
expect(screen.getByText('SUM')).toBeInTheDocument();
|
||||
expect(screen.getByText('Open')).toBeInTheDocument();
|
||||
});
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(screen.getByText('SELECT')).toBeInTheDocument();
|
||||
expect(screen.getByText('SUM')).toBeInTheDocument();
|
||||
expect(screen.getByText('Open')).toBeInTheDocument();
|
||||
},
|
||||
{ timeout: 5000 },
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user