fix(sqllab): clean comments within quotes (#23908)

This commit is contained in:
JUST.in DO IT
2023-05-05 09:55:45 -07:00
committed by GitHub
parent aabab5c456
commit 841726d432
2 changed files with 70 additions and 3 deletions

View File

@@ -312,7 +312,16 @@ describe('async actions', () => {
const makeRequest = () => {
const request = actions.runQuery({
...query,
sql: '/*\nSELECT * FROM\n */\nSELECT 213--, {{ds}}\n/*\n{{new_param1}}\n{{new_param2}}*/\n\nFROM table',
sql: `/*
SELECT * FROM
*/
SELECT 213--, {{ds}} "quote out"
/*
{{new_param1}}
{{new_param2}}*/
FROM table
WHERE value = '--"NULL"--' --{{test_param}}`,
});
return request(dispatch, () => initialState);
};
@@ -326,7 +335,7 @@ describe('async actions', () => {
expect(fetchMock.calls(runQueryEndpoint)).toHaveLength(1);
expect(
JSON.parse(fetchMock.calls(runQueryEndpoint)[0][1].body).sql,
).toEqual('SELECT 213\n\n\nFROM table');
).toEqual(`SELECT 213\n\n\nFROM table\nWHERE value = '--"NULL"--'`);
});
});
});