fix(sql lab): MultiSelector component render twice (#20706)

* fix(sql lab): MultiSelector component render twice

* filter null/undefined tables
This commit is contained in:
Diego Medina
2022-07-19 08:33:15 -03:00
committed by GitHub
parent e60083b45b
commit 115ab700df
6 changed files with 43 additions and 17 deletions

View File

@@ -835,7 +835,7 @@ describe('async actions', () => {
});
});
describe('removeTable', () => {
describe('removeTables', () => {
it('updates the table schema state in the backend', () => {
expect.assertions(2);
@@ -843,15 +843,32 @@ describe('async actions', () => {
const store = mockStore({});
const expectedActions = [
{
type: actions.REMOVE_TABLE,
table,
type: actions.REMOVE_TABLES,
tables: [table],
},
];
return store.dispatch(actions.removeTable(table)).then(() => {
return store.dispatch(actions.removeTables([table])).then(() => {
expect(store.getActions()).toEqual(expectedActions);
expect(fetchMock.calls(updateTableSchemaEndpoint)).toHaveLength(1);
});
});
it('deletes multiple tables and updates the table schema state in the backend', () => {
expect.assertions(2);
const tables = [{ id: 1 }, { id: 2 }];
const store = mockStore({});
const expectedActions = [
{
type: actions.REMOVE_TABLES,
tables,
},
];
return store.dispatch(actions.removeTables(tables)).then(() => {
expect(store.getActions()).toEqual(expectedActions);
expect(fetchMock.calls(updateTableSchemaEndpoint)).toHaveLength(2);
});
});
});
describe('migrateQueryEditorFromLocalStorage', () => {