From d3b098b407d5636f9c2f71823dca6d310b3f105c Mon Sep 17 00:00:00 2001 From: Jukka Lipka <3710455+jlipka@users.noreply.github.com> Date: Mon, 26 May 2025 12:51:24 +0200 Subject: [PATCH] fix: cleanup / unnecessary changes reverted (cherry picked from commit 55d2f0ce38be01a435d68e743c0b60666996d3bc) --- .../comcol-role/comcol-role.component.spec.ts | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/app/shared/comcol/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts b/src/app/shared/comcol/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts index ff5435c7a1..9095ecbc81 100644 --- a/src/app/shared/comcol/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts +++ b/src/app/shared/comcol/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component.spec.ts @@ -180,14 +180,17 @@ describe('ComcolRoleComponent', () => { name: 'custom group name', }; statusCode = 200; - comp.comcolRole = { - name: 'test role name' + Math.random(), - href: 'test role link', - }; - comp.roleName$ = of(comcolRole.name); + comp.comcolRole = comcolRole; fixture.detectChanges(); }); + afterEach(() => { + const modal = document.querySelector('ds-confirmation-modal'); + if (modal) { + modal.remove(); + } + }); + it('should have a delete button but no create or restrict button', (done) => { expect(de.query(By.css('.btn.create'))).toBeNull(); expect(de.query(By.css('.btn.restrict'))).toBeNull(); @@ -201,16 +204,8 @@ describe('ComcolRoleComponent', () => { de.query(By.css('.btn.delete')).nativeElement.click(); }); - afterEach(() => { - const modal = document.querySelector('ds-confirmation-modal'); - if (modal) { - modal.remove(); - } - }); - it('should call the groupService delete method', (done) => { (document as any).querySelector('.modal-footer .confirm').click(); - fixture.detectChanges(); expect(groupService.deleteComcolGroup).toHaveBeenCalled(); done(); }); @@ -220,20 +215,10 @@ describe('ComcolRoleComponent', () => { beforeEach(() => { groupService.deleteComcolGroup.and.returnValue(createFailedRemoteDataObject$()); de.query(By.css('.btn.delete')).nativeElement.click(); - fixture.detectChanges(); - }); - - afterEach(() => { - const modal = document.querySelector('ds-confirmation-modal'); - if (modal) { - modal.remove(); - } }); it('should show an error notification', (done) => { (document as any).querySelector('.modal-footer .confirm').click(); - fixture.detectChanges(); - expect(notificationsService.error).toHaveBeenCalled(); done(); });