Skip to content

Commit

Permalink
fix backend tests
Browse files Browse the repository at this point in the history
Signed-off-by: engelharddirk <[email protected]>
  • Loading branch information
engelharddirk committed Dec 10, 2024
1 parent 7f9269e commit 4f042e1
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 20 deletions.
1 change: 1 addition & 0 deletions apps/backend/src/app/alerting/alerting.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const mockedBackupDataEntity: BackupDataEntity = {
sizeMB: 100,
type: BackupType.FULL,
creationDate: new Date(),
saveset: 'saveset1',
};

const mockedSizeAlertTypeEntity: AlertTypeEntity = {
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/app/alerting/alerting.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const mockedBackupDataEntity: BackupDataEntity = {
sizeMB: 100,
type: BackupType.FULL,
creationDate: new Date(),
saveset: 'saveset1',
};

const mockedSizeAlertTypeEntity: AlertTypeEntity = {
Expand Down
12 changes: 6 additions & 6 deletions apps/backend/src/app/alerting/alerting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class AlertingService {
async createSizeAlert(createSizeAlertDto: CreateSizeAlertDto) {
// Check if alert already exists
const existingAlertEntity = await this.sizeAlertRepository.findOneBy({
backup: { id: createSizeAlertDto.backupUuid },
backup: { id: createSizeAlertDto.backupId },
});

if (existingAlertEntity) {
Expand All @@ -138,11 +138,11 @@ export class AlertingService {
alert.referenceSize = createSizeAlertDto.referenceSize;

const backup = await this.backupDataService.findOneById(
createSizeAlertDto.backupUuid
createSizeAlertDto.backupId
);
if (!backup) {
throw new NotFoundException(
`Backup with id ${createSizeAlertDto.backupUuid} not found`
`Backup with id ${createSizeAlertDto.backupId} not found`
);
}
alert.backup = backup;
Expand All @@ -167,7 +167,7 @@ export class AlertingService {
) {
// Check if alert already exists
const existingAlertEntity = await this.creationDateRepository.findOneBy({
backup: { id: createCreationDateAlertDto.backupUuid },
backup: { id: createCreationDateAlertDto.backupId },
});

if (existingAlertEntity) {
Expand All @@ -180,11 +180,11 @@ export class AlertingService {
alert.referenceDate = createCreationDateAlertDto.referenceDate;

const backup = await this.backupDataService.findOneById(
createCreationDateAlertDto.backupUuid
createCreationDateAlertDto.backupId
);
if (!backup) {
throw new NotFoundException(
`Backup with id ${createCreationDateAlertDto.backupUuid} not found`
`Backup with id ${createCreationDateAlertDto.backupId} not found`
);
}
alert.backup = backup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ export class CreateCreationDateAlertDto {
description: 'Uuid of the Backup',
required: true,
})
backupUuid!: string;

@ApiProperty({
description: 'Saveset name of the belonging backup',
required: true,
})
backupSaveset!: string;
backupId!: string;

@ApiProperty({
description: 'Date, the backup started',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ export class CreateSizeAlertDto {
description: 'Uuid of the Backup',
required: true,
})
backupUuid!: string;

@ApiProperty({
description: 'Saveset name of the belonging backup',
required: true,
})
backupSaveset!: string;
backupId!: string;

@ApiProperty({
description: 'Size of the Backup, which is the reason for the alert',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('BackupDataController (e2e)', () => {

expect(response.body).toEqual({
id: createBackupDataDto.id,
saveset: createBackupDataDto.saveset,
sizeMB: createBackupDataDto.sizeMB,
creationDate: createBackupDataDto.creationDate.toISOString(),
});
Expand Down
1 change: 1 addition & 0 deletions apps/backend/src/app/utils/mail/mail.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('MailService', () => {
sizeMB: 100,
type: BackupType.FULL,
creationDate: new Date(),
saveset: 'saveset1',
},
};

Expand Down

0 comments on commit 4f042e1

Please sign in to comment.