diff --git a/apps/server/src/infra/calendar/service/calendar.service.spec.ts b/apps/server/src/infra/calendar/service/calendar.service.spec.ts index bb9709a0d9d..7eaf65ce2a3 100644 --- a/apps/server/src/infra/calendar/service/calendar.service.spec.ts +++ b/apps/server/src/infra/calendar/service/calendar.service.spec.ts @@ -15,7 +15,7 @@ import { DomainName, DomainOperationReportBuilder, OperationType, -} from '@src/modules/deletion'; +} from '@modules/deletion'; import { CalendarEvent } from '../interface/calendar-event.interface'; import { CalendarMapper } from '../mapper/calendar.mapper'; @@ -131,10 +131,13 @@ describe('CalendarServiceSpec', () => { }); }); describe('When calling the delete events method with scopeId which does not exist', () => { - it('should throw error if cannot delete a events', async () => { + const setup = () => { const error = 'error'; httpService.delete.mockReturnValue(throwError(() => error)); + }; + it('should throw error if cannot delete a events', async () => { + setup(); await expect(service.deleteEventsByScopeId('invalid eventId')).rejects.toThrowError( InternalServerErrorException ); @@ -174,7 +177,7 @@ describe('CalendarServiceSpec', () => { const userId: EntityId = '1'; const expectedResult = DomainDeletionReportBuilder.build(DomainName.CALENDAR, [ - DomainOperationReportBuilder.build(OperationType.DELETE, Number.NaN, [userId]), + DomainOperationReportBuilder.build(OperationType.DELETE, 0, [userId]), ]); return { diff --git a/apps/server/src/infra/calendar/service/calendar.service.ts b/apps/server/src/infra/calendar/service/calendar.service.ts index 037b25d971d..2458d479880 100644 --- a/apps/server/src/infra/calendar/service/calendar.service.ts +++ b/apps/server/src/infra/calendar/service/calendar.service.ts @@ -18,7 +18,7 @@ import { OperationType, StatusModel, UserDeletedEvent, -} from '@src/modules/deletion'; +} from '@modules/deletion'; import { EntityId } from '@shared/domain/types'; import { CalendarEventDto } from '../dto/calendar-event.dto'; import { CalendarEvent } from '../interface/calendar-event.interface'; @@ -63,7 +63,7 @@ export class CalendarService implements DeletionService, IEventHandler