From 65c789a4145d1639298c8613a6d9e323c4218b31 Mon Sep 17 00:00:00 2001 From: George Nash Date: Thu, 11 Apr 2024 11:56:39 +0100 Subject: [PATCH] fixed tests --- .../app/affiliation/affiliation-delete.component.spec.ts | 8 ++------ ui/src/app/shared/service/event.service.spec.ts | 4 +--- ui/src/app/user/user-delete.component.spec.ts | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/ui/src/app/affiliation/affiliation-delete.component.spec.ts b/ui/src/app/affiliation/affiliation-delete.component.spec.ts index 53ff733a1..366ed9392 100644 --- a/ui/src/app/affiliation/affiliation-delete.component.spec.ts +++ b/ui/src/app/affiliation/affiliation-delete.component.spec.ts @@ -45,18 +45,14 @@ describe('AffiliationDeleteComponent', () => { affiliationService.delete.and.returnValue(of(true)) component.confirmDelete('id') - expect(eventService.broadcast).toHaveBeenCalledWith( - new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Deleted an affiliation') - ) + expect(eventService.broadcast).toHaveBeenCalledWith(new Event(EventType.AFFILIATION_LIST_MODIFICATION)) }) it('should fail to delete the affiliation', () => { affiliationService.delete.and.returnValue(of(false)) component.confirmDelete('id') - expect(eventService.broadcast).toHaveBeenCalledWith( - new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Failed to delete an affiliation') - ) + expect(eventService.broadcast).toHaveBeenCalledWith(new Event(EventType.AFFILIATION_LIST_MODIFICATION)) }) it('should not call the assertion service without an id', () => { diff --git a/ui/src/app/shared/service/event.service.spec.ts b/ui/src/app/shared/service/event.service.spec.ts index a9e1fdc96..892e98107 100644 --- a/ui/src/app/shared/service/event.service.spec.ts +++ b/ui/src/app/shared/service/event.service.spec.ts @@ -16,7 +16,6 @@ describe('EventService', () => { it('should broadcast events', () => { const event: Event = { type: EventType.LOG_IN_SUCCESS, - payload: 'Login successful', } let receivedEvent: Event | undefined @@ -30,10 +29,9 @@ describe('EventService', () => { }) it('should filter events by type', () => { - const event1: Event = { type: EventType.LOG_IN_SUCCESS, payload: 'data 1' } + const event1: Event = { type: EventType.LOG_IN_SUCCESS } const event2: Event = { type: EventType.AFFILIATION_CREATED, - payload: 'data 2', } let receivedEvent: Event | undefined diff --git a/ui/src/app/user/user-delete.component.spec.ts b/ui/src/app/user/user-delete.component.spec.ts index c945a0272..aaf7a905c 100644 --- a/ui/src/app/user/user-delete.component.spec.ts +++ b/ui/src/app/user/user-delete.component.spec.ts @@ -47,7 +47,7 @@ describe('UserDeleteComponent', () => { userServiceSpy.delete.and.returnValue(of(true)) component.confirmDelete('id') - expect(eventServiceSpy.broadcast).toHaveBeenCalledWith(new Event(EventType.USER_LIST_MODIFIED, 'Deleted a user')) + expect(eventServiceSpy.broadcast).toHaveBeenCalledWith(new Event(EventType.USER_LIST_MODIFIED)) }) it('should not call the userservice without a provided id', () => {