diff --git a/src/app/modeler/modeler.component.spec.ts b/src/app/modeler/modeler.component.spec.ts index 47f38e6..9718f85 100644 --- a/src/app/modeler/modeler.component.spec.ts +++ b/src/app/modeler/modeler.component.spec.ts @@ -312,6 +312,8 @@ describe('ModelerComponent', () => { }; const updateFileMetaSpy = spyOn(component.api, 'updateFileMeta') .and.returnValue(of(mockFileMeta0)); + const updateFileDataSpy = spyOn(component.api, 'updateFileData') + .and.returnValue(of(mockFileMeta0.file)); const loadFilesFromDbSpy = spyOn(component, 'loadFilesFromDb').and.stub(); const snackBarSpy = spyOn(component.snackBar, 'open').and.stub(); const noDateOrVersion: FileMeta = { @@ -326,7 +328,8 @@ describe('ModelerComponent', () => { component.draftXml = newXml; component._upsertFileMeta(data); expect(component.xml).toEqual(newXml); - expect(updateFileMetaSpy).toHaveBeenCalledWith(mockWorkflowSpec0.id, noDateOrVersion); + expect(updateFileMetaSpy).toHaveBeenCalledWith(noDateOrVersion); + expect(updateFileDataSpy).toHaveBeenCalledWith(noDateOrVersion); expect(loadFilesFromDbSpy).toHaveBeenCalled(); expect(snackBarSpy).toHaveBeenCalled(); }); diff --git a/src/app/modeler/modeler.component.ts b/src/app/modeler/modeler.component.ts index fb534b1..42eaa4d 100644 --- a/src/app/modeler/modeler.component.ts +++ b/src/app/modeler/modeler.component.ts @@ -263,9 +263,11 @@ export class ModelerComponent implements AfterViewInit { if (this.workflowSpec && isNumberDefined(fileMetaId)) { // Update existing file meta - this.api.updateFileMeta(this.diagramFileMeta).subscribe(fileMeta => { - this.loadFilesFromDb(); - this.snackBar.open(`Saved changes to file ${fileMeta.name}.`, 'Ok', {duration: 5000}); + this.api.updateFileData(this.diagramFileMeta).subscribe(() => { + this.api.updateFileMeta(this.diagramFileMeta).subscribe(() => { + this.loadFilesFromDb(); + this.snackBar.open(`Saved changes to file ${this.diagramFileMeta.name}.`, 'Ok', {duration: 5000}); + }); }); } else { // Add new file meta