chore(sqllab): refactor addQueryEditor for new tab (#21711)

This commit is contained in:
JUST.in DO IT
2022-10-07 13:57:39 -07:00
committed by GitHub
parent a5ff0949a6
commit 0c461497ff
5 changed files with 73 additions and 32 deletions

View File

@@ -418,6 +418,28 @@ describe('async actions', () => {
expect(store.getActions()).toEqual(expectedActions);
});
});
describe('addNewQueryEditor', () => {
it('creates new query editor with new tab name', () => {
const store = mockStore(initialState);
const expectedActions = [
{
type: actions.ADD_QUERY_EDITOR,
queryEditor: {
...defaultQueryEditor,
id: 'abcd',
name: `Untitled Query ${
store.getState().sqlLab.queryEditors.length + 1
}`,
},
},
];
const request = actions.addNewQueryEditor(defaultQueryEditor);
return request(store.dispatch, store.getState).then(() => {
expect(store.getActions()).toEqual(expectedActions);
});
});
});
});
describe('backend sync', () => {