ACS-8770: fix load versions test by breaking then() calls chain once assertion is checked

This commit is contained in:
Anton Ramanovich
2025-06-18 16:08:43 +02:00
parent 88abd309a5
commit 2876d09e74

View File

@@ -208,12 +208,16 @@ describe('VersionListComponent', () => {
expect(component.versionsApi.revertVersion).not.toHaveBeenCalled(); expect(component.versionsApi.revertVersion).not.toHaveBeenCalled();
}); });
it('should load the versions for a given id', () => { it('should load the versions for a given id', async () => {
fixture.detectChanges(); fixture.detectChanges();
const spyOnRevertVersion = spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(versionTest[0])); const spyOnRevertVersion = spyOn(component.versionsApi, 'revertVersion').and.callFake(() => Promise.resolve(versionTest[0]));
const spyOnOnVersionRestored = spyOn(component, 'onVersionRestored').and.stub();
component.restore(versionId); component.restore(versionId);
await fixture.whenStable();
expect(spyOnRevertVersion).toHaveBeenCalledWith(nodeId, versionId, { majorVersion: true, comment: '' }); expect(spyOnRevertVersion).toHaveBeenCalledWith(nodeId, versionId, { majorVersion: true, comment: '' });
expect(spyOnOnVersionRestored).toHaveBeenCalled();
}); });
it('should get node info after restoring the node', fakeAsync(() => { it('should get node info after restoring the node', fakeAsync(() => {