mirror of
https://github.com/apache/superset.git
synced 2026-04-23 01:55:09 +00:00
fix(sqllab): autocomplete and delete tabs (#34781)
This commit is contained in:
@@ -240,11 +240,13 @@ describe('sqlLabReducer', () => {
|
||||
);
|
||||
});
|
||||
it('should migrate query editor by new query editor id', () => {
|
||||
const { length } = newState.queryEditors;
|
||||
const index = newState.queryEditors.findIndex(({ id }) => id === qe.id);
|
||||
const newQueryEditor = {
|
||||
...qe,
|
||||
id: 'updatedNewId',
|
||||
tabViewId: 'updatedNewId',
|
||||
schema: 'updatedSchema',
|
||||
inLocalStorage: false,
|
||||
};
|
||||
const action = {
|
||||
type: actions.MIGRATE_QUERY_EDITOR,
|
||||
@@ -252,8 +254,18 @@ describe('sqlLabReducer', () => {
|
||||
newQueryEditor,
|
||||
};
|
||||
newState = sqlLabReducer(newState, action);
|
||||
expect(newState.queryEditors[index].id).toEqual('updatedNewId');
|
||||
expect(newState.queryEditors[index].id).toEqual(qe.id);
|
||||
expect(newState.queryEditors[index].tabViewId).toEqual('updatedNewId');
|
||||
expect(newState.queryEditors[index]).toEqual(newQueryEditor);
|
||||
const removeAction = {
|
||||
type: actions.REMOVE_QUERY_EDITOR,
|
||||
queryEditor: newQueryEditor,
|
||||
};
|
||||
newState = sqlLabReducer(newState, removeAction);
|
||||
expect(newState.queryEditors).toHaveLength(length - 1);
|
||||
expect(Object.keys(newState.destroyedQueryEditors)).toContain(
|
||||
newQueryEditor.tabViewId,
|
||||
);
|
||||
});
|
||||
it('should clear the destroyed query editors', () => {
|
||||
const expectedQEId = '1233289';
|
||||
|
||||
Reference in New Issue
Block a user