mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
fix(sqllab): throw errors of commented out query (#23378)
This commit is contained in:
@@ -308,6 +308,29 @@ describe('async actions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('runQuery with comments', () => {
|
||||
const makeRequest = () => {
|
||||
const request = actions.runQuery({
|
||||
...query,
|
||||
sql: '/*\nSELECT * FROM\n */\nSELECT 213--, {{ds}}\n/*\n{{new_param1}}\n{{new_param2}}*/\n\nFROM table',
|
||||
});
|
||||
return request(dispatch, () => initialState);
|
||||
};
|
||||
|
||||
it('makes the fetch request without comments', async () => {
|
||||
const runQueryEndpoint = 'glob:*/api/v1/sqllab/execute/';
|
||||
fetchMock.post(runQueryEndpoint, '{}', {
|
||||
overwriteRoutes: true,
|
||||
});
|
||||
await makeRequest().then(() => {
|
||||
expect(fetchMock.calls(runQueryEndpoint)).toHaveLength(1);
|
||||
expect(
|
||||
JSON.parse(fetchMock.calls(runQueryEndpoint)[0][1].body).sql,
|
||||
).toEqual('SELECT 213\n\n\nFROM table');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('reRunQuery', () => {
|
||||
let stub;
|
||||
beforeEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user