Skip to content

Commit 4ec667c

Browse files
committed
Add unit test
1 parent d6cd816 commit 4ec667c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Diff for: server/e2e/jobs/specs/metadata.e2e-spec.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe(`${AssetController.name} (e2e)`, () => {
3636
await restoreTempFolder();
3737
});
3838

39-
describe.only('should strip metadata of', () => {
39+
describe('should strip metadata of', () => {
4040
let assetWithLocation: AssetResponseDto;
4141

4242
beforeEach(async () => {
@@ -84,4 +84,26 @@ describe(`${AssetController.name} (e2e)`, () => {
8484
expect(exifData).not.toHaveProperty('GPSLatitude');
8585
});
8686
});
87+
88+
describe.each([
89+
// These hashes were created by copying the image files to a Samsung phone,
90+
// exporting the video from Samsung's stock Gallery app, and hashing them locally.
91+
// This ensures that immich+exiftool are extracting the videos the same way Samsung does.
92+
// DO NOT assume immich+exiftool are doing things correctly and just copy whatever hash it gives
93+
// into the test here.
94+
['Samsung One UI 5.jpg', 'fr14niqCq6N20HB8rJYEvpsUVtI='],
95+
['Samsung One UI 6.jpg', 'lT9Uviw/FFJYCjfIxAGPTjzAmmw='],
96+
['Samsung One UI 6.heic', '/ejgzywvgvzvVhUYVfvkLzFBAF0='],
97+
])('should extract motionphoto video', (file, checksum) => {
98+
itif(runAllTests)(`with checksum ${checksum} from ${file}`, async () => {
99+
const fileContent = await fs.promises.readFile(`${IMMICH_TEST_ASSET_PATH}/formats/motionphoto/${file}`);
100+
101+
const response = await api.assetApi.upload(server, admin.accessToken, 'test-asset-id', { content: fileContent });
102+
const asset = await api.assetApi.get(server, admin.accessToken, response.id);
103+
expect(asset).toHaveProperty('livePhotoVideoId');
104+
const video = await api.assetApi.get(server, admin.accessToken, asset.livePhotoVideoId as string);
105+
106+
expect(video.checksum).toStrictEqual(checksum);
107+
});
108+
});
87109
});

0 commit comments

Comments
 (0)