@@ -883,7 +883,7 @@ describe('async actions', () => {
883883 it ( 'updates the table schema state in the backend' , ( ) => {
884884 expect . assertions ( 2 ) ;
885885
886- const table = { id : 1 } ;
886+ const table = { id : 1 , initialized : true } ;
887887 const store = mockStore ( { } ) ;
888888 const expectedActions = [
889889 {
@@ -900,7 +900,10 @@ describe('async actions', () => {
900900 it ( 'deletes multiple tables and updates the table schema state in the backend' , ( ) => {
901901 expect . assertions ( 2 ) ;
902902
903- const tables = [ { id : 1 } , { id : 2 } ] ;
903+ const tables = [
904+ { id : 1 , initialized : true } ,
905+ { id : 2 , initialized : true } ,
906+ ] ;
904907 const store = mockStore ( { } ) ;
905908 const expectedActions = [
906909 {
@@ -913,6 +916,23 @@ describe('async actions', () => {
913916 expect ( fetchMock . calls ( updateTableSchemaEndpoint ) ) . toHaveLength ( 2 ) ;
914917 } ) ;
915918 } ) ;
919+
920+ it ( 'only updates the initialized table schema state in the backend' , ( ) => {
921+ expect . assertions ( 2 ) ;
922+
923+ const tables = [ { id : 1 } , { id : 2 , initialized : true } ] ;
924+ const store = mockStore ( { } ) ;
925+ const expectedActions = [
926+ {
927+ type : actions . REMOVE_TABLES ,
928+ tables,
929+ } ,
930+ ] ;
931+ return store . dispatch ( actions . removeTables ( tables ) ) . then ( ( ) => {
932+ expect ( store . getActions ( ) ) . toEqual ( expectedActions ) ;
933+ expect ( fetchMock . calls ( updateTableSchemaEndpoint ) ) . toHaveLength ( 1 ) ;
934+ } ) ;
935+ } ) ;
916936 } ) ;
917937
918938 describe ( 'migrateQueryEditorFromLocalStorage' , ( ) => {
0 commit comments