Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bobcaprice committed Apr 11, 2024
1 parent 4d5295d commit 65c789a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
8 changes: 2 additions & 6 deletions ui/src/app/affiliation/affiliation-delete.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 1 addition & 3 deletions ui/src/app/shared/service/event.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/user/user-delete.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 65c789a

Please sign in to comment.