refactor(server): e2e (#6632)

This commit is contained in:
Jason Rasmussen
2024-01-24 17:24:53 -05:00
committed by GitHub
parent 4424f3cb13
commit 852effa998
43 changed files with 154 additions and 485 deletions
+2 -44
View File
@@ -5,7 +5,7 @@ import { errorStub, uuidStub } from '@test/fixtures';
import * as fs from 'fs';
import request from 'supertest';
import { utimes } from 'utimes';
import { api } from '../client';
import { api } from '../../client';
import { IMMICH_TEST_ASSET_PATH, IMMICH_TEST_ASSET_TEMP_PATH, restoreTempFolder, testApp } from '../utils';
describe(`${LibraryController.name} (e2e)`, () => {
@@ -13,7 +13,7 @@ describe(`${LibraryController.name} (e2e)`, () => {
let admin: LoginResponseDto;
beforeAll(async () => {
server = (await testApp.create({ jobs: true })).getHttpServer();
server = (await testApp.create()).getHttpServer();
});
afterAll(async () => {
@@ -148,48 +148,6 @@ describe(`${LibraryController.name} (e2e)`, () => {
);
});
it('should scan external library with import paths', async () => {
const library = await api.libraryApi.create(server, admin.accessToken, {
type: LibraryType.EXTERNAL,
importPaths: [`${IMMICH_TEST_ASSET_PATH}/albums/nature`],
});
await api.userApi.setExternalPath(server, admin.accessToken, admin.userId, '/');
await api.libraryApi.scanLibrary(server, admin.accessToken, library.id);
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
expect(assets).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: AssetType.IMAGE,
originalFileName: 'el_torcal_rocks',
libraryId: library.id,
resized: true,
exifInfo: expect.objectContaining({
exifImageWidth: 512,
exifImageHeight: 341,
latitude: null,
longitude: null,
}),
}),
expect.objectContaining({
type: AssetType.IMAGE,
originalFileName: 'silver_fir',
libraryId: library.id,
resized: true,
thumbhash: expect.any(String),
exifInfo: expect.objectContaining({
exifImageWidth: 511,
exifImageHeight: 323,
latitude: null,
longitude: null,
}),
}),
]),
);
});
it('should offline missing files', async () => {
await fs.promises.cp(`${IMMICH_TEST_ASSET_PATH}/albums/nature`, `${IMMICH_TEST_ASSET_TEMP_PATH}/albums/nature`, {
recursive: true,