mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 09:13:15 +03:00
refactor: e2e (#7703)
* refactor: e2e * fix: submodule check * chore: extend startup timeout
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { AssetFileUploadResponseDto, LoginResponseDto } from '@immich/sdk';
|
||||
import { readFile, writeFile } from 'node:fs/promises';
|
||||
import { errorDto } from 'src/responses';
|
||||
import { apiUtils, app, dbUtils, fileUtils, tempDir } from 'src/utils';
|
||||
import { app, tempDir, utils } from 'src/utils';
|
||||
import request from 'supertest';
|
||||
import { beforeAll, describe, expect, it } from 'vitest';
|
||||
|
||||
@@ -11,13 +11,9 @@ describe('/download', () => {
|
||||
let asset2: AssetFileUploadResponseDto;
|
||||
|
||||
beforeAll(async () => {
|
||||
apiUtils.setup();
|
||||
await dbUtils.reset();
|
||||
admin = await apiUtils.adminSetup();
|
||||
[asset1, asset2] = await Promise.all([
|
||||
apiUtils.createAsset(admin.accessToken),
|
||||
apiUtils.createAsset(admin.accessToken),
|
||||
]);
|
||||
await utils.resetDatabase();
|
||||
admin = await utils.adminSetup();
|
||||
[asset1, asset2] = await Promise.all([utils.createAsset(admin.accessToken), utils.createAsset(admin.accessToken)]);
|
||||
});
|
||||
|
||||
describe('POST /download/info', () => {
|
||||
@@ -65,15 +61,15 @@ describe('/download', () => {
|
||||
expect(body instanceof Buffer).toBe(true);
|
||||
|
||||
await writeFile(`${tempDir}/archive.zip`, body);
|
||||
await fileUtils.unzip(`${tempDir}/archive.zip`, `${tempDir}/archive`);
|
||||
await utils.unzip(`${tempDir}/archive.zip`, `${tempDir}/archive`);
|
||||
const files = [
|
||||
{ filename: 'example.png', id: asset1.id },
|
||||
{ filename: 'example+1.png', id: asset2.id },
|
||||
];
|
||||
for (const { id, filename } of files) {
|
||||
const bytes = await readFile(`${tempDir}/archive/${filename}`);
|
||||
const asset = await apiUtils.getAssetInfo(admin.accessToken, id);
|
||||
expect(fileUtils.sha1(bytes)).toBe(asset.checksum);
|
||||
const asset = await utils.getAssetInfo(admin.accessToken, id);
|
||||
expect(utils.sha1(bytes)).toBe(asset.checksum);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user