mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
fix: allow option to generate new query (#13488)
This commit is contained in:
committed by
GitHub
parent
ecfcaea803
commit
b97bbed2a9
@@ -173,7 +173,7 @@ describe('async actions', () => {
|
||||
|
||||
fetchMock.get(
|
||||
fetchQueryEndpoint,
|
||||
{ throws: { error: 'error text' } },
|
||||
{ throws: { message: 'error text' } },
|
||||
{ overwriteRoutes: true },
|
||||
);
|
||||
|
||||
@@ -238,7 +238,7 @@ describe('async actions', () => {
|
||||
|
||||
fetchMock.post(
|
||||
runQueryEndpoint,
|
||||
{ throws: { error: 'error text' } },
|
||||
{ throws: { message: 'error text' } },
|
||||
{ overwriteRoutes: true },
|
||||
);
|
||||
|
||||
@@ -252,6 +252,29 @@ describe('async actions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('reRunQuery', () => {
|
||||
let stub;
|
||||
beforeEach(() => {
|
||||
stub = sinon.stub(shortid, 'generate').returns('abcd');
|
||||
});
|
||||
afterEach(() => {
|
||||
stub.restore();
|
||||
});
|
||||
|
||||
it('creates new query with a new id', () => {
|
||||
const id = 'id';
|
||||
const state = {
|
||||
sqlLab: {
|
||||
tabHistory: [id],
|
||||
queryEditors: [{ id, title: 'Dummy query editor' }],
|
||||
},
|
||||
};
|
||||
const store = mockStore(state);
|
||||
store.dispatch(actions.reRunQuery(query));
|
||||
expect(store.getActions()[0].query.id).toEqual('abcd');
|
||||
});
|
||||
});
|
||||
|
||||
describe('postStopQuery', () => {
|
||||
const stopQueryEndpoint = 'glob:*/superset/stop_query/*';
|
||||
fetchMock.post(stopQueryEndpoint, {});
|
||||
|
||||
Reference in New Issue
Block a user