High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
test(server): check motion asset create arguments (#9826)
Lukas588860455ff9
diff --git a/server/src/services/metadata.service.spec.ts b/server/src/services/metadata.service.spec.tsindex d981436ac7..2c2c59cbbb 100644--- a/server/src/services/metadata.service.spec.ts+++ b/server/src/services/metadata.service.spec.ts@@ -383,7 +383,21 @@ describe(MetadataService.name, () => {'MotionPhotoVideo',);expect(assetMock.getByIds).toHaveBeenCalledWith([assetStub.livePhotoWithOriginalFileName.id]);- expect(assetMock.create).toHaveBeenCalled(); // This could have arguments added+ expect(assetMock.create).toHaveBeenCalledWith({+ checksum: expect.any(Buffer),+ deviceAssetId: 'NONE',+ deviceId: 'NONE',+ fileCreatedAt: assetStub.livePhotoWithOriginalFileName.fileCreatedAt,+ fileModifiedAt: assetStub.livePhotoWithOriginalFileName.fileModifiedAt,+ id: fileStub.livePhotoMotion.uuid,+ isVisible: false,+ libraryId: assetStub.livePhotoWithOriginalFileName.libraryId,+ localDateTime: assetStub.livePhotoWithOriginalFileName.fileCreatedAt,+ originalFileName: 'asset_1.mp4',+ originalPath: 'upload/encoded-video/user-id/li/ve/live-photo-motion-asset-MP.mp4',+ ownerId: assetStub.livePhotoWithOriginalFileName.ownerId,+ type: AssetType.VIDEO,+ });expect(userMock.updateUsage).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.ownerId, 512);expect(storageMock.writeFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);expect(assetMock.update).toHaveBeenNthCalledWith(1, {@@ -412,7 +426,21 @@ describe(MetadataService.name, () => {'EmbeddedVideoFile',);expect(assetMock.getByIds).toHaveBeenCalledWith([assetStub.livePhotoWithOriginalFileName.id]);- expect(assetMock.create).toHaveBeenCalled(); // This could have arguments added+ expect(assetMock.create).toHaveBeenCalledWith({+ checksum: expect.any(Buffer),+ deviceAssetId: 'NONE',+ deviceId: 'NONE',+ fileCreatedAt: assetStub.livePhotoWithOriginalFileName.fileCreatedAt,+ fileModifiedAt: assetStub.livePhotoWithOriginalFileName.fileModifiedAt,+ id: fileStub.livePhotoMotion.uuid,+ isVisible: false,+ libraryId: assetStub.livePhotoWithOriginalFileName.libraryId,+ localDateTime: assetStub.livePhotoWithOriginalFileName.fileCreatedAt,+ originalFileName: 'asset_1.mp4',+ originalPath: 'upload/encoded-video/user-id/li/ve/live-photo-motion-asset-MP.mp4',+ ownerId: assetStub.livePhotoWithOriginalFileName.ownerId,+ type: AssetType.VIDEO,+ });expect(userMock.updateUsage).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.ownerId, 512);expect(storageMock.writeFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);expect(assetMock.update).toHaveBeenNthCalledWith(1, {@@ -442,7 +470,21 @@ describe(MetadataService.name, () => {assetStub.livePhotoWithOriginalFileName.originalPath,expect.any(Object),);- expect(assetMock.create).toHaveBeenCalled(); // This could have arguments added+ expect(assetMock.create).toHaveBeenCalledWith({+ checksum: expect.any(Buffer),+ deviceAssetId: 'NONE',+ deviceId: 'NONE',+ fileCreatedAt: assetStub.livePhotoWithOriginalFileName.fileCreatedAt,+ fileModifiedAt: assetStub.livePhotoWithOriginalFileName.fileModifiedAt,+ id: fileStub.livePhotoMotion.uuid,+ isVisible: false,+ libraryId: assetStub.livePhotoWithOriginalFileName.libraryId,+ localDateTime: assetStub.livePhotoWithOriginalFileName.fileCreatedAt,+ originalFileName: 'asset_1.mp4',+ originalPath: 'upload/encoded-video/user-id/li/ve/live-photo-motion-asset-MP.mp4',+ ownerId: assetStub.livePhotoWithOriginalFileName.ownerId,+ type: AssetType.VIDEO,+ });expect(userMock.updateUsage).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.ownerId, 512);expect(storageMock.writeFile).toHaveBeenCalledWith(assetStub.livePhotoMotionAsset.originalPath, video);expect(assetMock.update).toHaveBeenNthCalledWith(1, {diff --git a/server/test/fixtures/asset.stub.ts b/server/test/fixtures/asset.stub.tsindex 56aeed9d81..12c4e7606e 100644--- a/server/test/fixtures/asset.stub.ts+++ b/server/test/fixtures/asset.stub.ts@@ -492,7 +492,7 @@ export const assetStub = {originalFileName: fileStub.livePhotoStill.originalName,ownerId: authStub.user1.user.id,type: AssetType.IMAGE,- livePhotoVideoId: 'live-photo-motion-asset123',+ livePhotoVideoId: 'live-photo-motion-asset',isVisible: true,fileModifiedAt: new Date('2022-06-19T23:41:36.910Z'),fileCreatedAt: new Date('2022-06-19T23:41:36.910Z'),