Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zdimension committed Aug 14, 2024
1 parent 340bc0f commit 5811c33
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
18 changes: 18 additions & 0 deletions server/src/services/media.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.SRGB,
processInvalidImages: false,
angle: 0,
mirror: false,
});
expect(assetMock.update).toHaveBeenCalledWith({ id: 'asset-id', previewPath });
});
Expand Down Expand Up @@ -328,6 +330,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: false,
angle: 0,
mirror: false,
},
);
expect(assetMock.update).toHaveBeenCalledWith({
Expand Down Expand Up @@ -471,6 +475,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.SRGB,
processInvalidImages: false,
angle: 0,
mirror: false,
});
expect(assetMock.update).toHaveBeenCalledWith({ id: 'asset-id', thumbnailPath });
},
Expand Down Expand Up @@ -502,6 +508,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: false,
angle: 0,
mirror: false,
},
);
expect(assetMock.update).toHaveBeenCalledWith({
Expand Down Expand Up @@ -529,6 +537,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: false,
angle: 0,
mirror: false,
},
],
]);
Expand All @@ -554,6 +564,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: false,
angle: 0,
mirror: false,
},
],
]);
Expand All @@ -577,6 +589,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: false,
angle: 0,
mirror: false,
},
);
expect(mediaMock.getImageDimensions).not.toHaveBeenCalled();
Expand All @@ -598,6 +612,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: false,
angle: 0,
mirror: false,
},
);
expect(mediaMock.getImageDimensions).not.toHaveBeenCalled();
Expand All @@ -619,6 +635,8 @@ describe(MediaService.name, () => {
quality: 80,
colorspace: Colorspace.P3,
processInvalidImages: true,
angle: 0,
mirror: false,
},
);
expect(mediaMock.getImageDimensions).not.toHaveBeenCalled();
Expand Down
3 changes: 3 additions & 0 deletions server/src/services/metadata.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ describe(MetadataService.name, () => {
const description = 'this is a description';
const gps = 12;
const date = '2023-11-22T04:56:12.196Z';
const orientation = 6;

assetMock.getByIds.mockResolvedValue([assetStub.sidecar]);
await expect(
Expand All @@ -943,6 +944,7 @@ describe(MetadataService.name, () => {
latitude: gps,
longitude: gps,
dateTimeOriginal: date,
orientation: orientation.toString(),
}),
).resolves.toBe(JobStatus.SUCCESS);
expect(metadataMock.writeTags).toHaveBeenCalledWith(assetStub.sidecar.sidecarPath, {
Expand All @@ -951,6 +953,7 @@ describe(MetadataService.name, () => {
DateTimeOriginal: date,
GPSLatitude: gps,
GPSLongitude: gps,
'Orientation#': orientation,
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion server/src/services/metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class MetadataService implements OnEvents {
DateTimeOriginal: dateTimeOriginal,
GPSLatitude: latitude,
GPSLongitude: longitude,
'Orientation#': Number.parseInt(orientation ?? '1', 10),
'Orientation#': _.isUndefined(orientation) ? undefined : Number.parseInt(orientation ?? '1', 10),
Rating: rating,
},
_.isUndefined,
Expand Down

0 comments on commit 5811c33

Please sign in to comment.