refactor: e2e tests (#4536)

This commit is contained in:
Jason Rasmussen 2023-10-18 18:02:42 -04:00 committed by GitHub
parent 31987bc043
commit 4b59f83288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 189 additions and 201 deletions

View file

@ -1,11 +1,9 @@
import { LoginResponseDto } from '@app/domain';
import { AssetType, LibraryType } from '@app/infra/entities';
import { INestApplication } from '@nestjs/common';
import { api } from '@test/api';
import { IMMICH_TEST_ASSET_PATH, createTestApp, db, runAllTests } from '@test/test-utils';
import { IMMICH_TEST_ASSET_PATH, db, runAllTests, testApp } from '@test/test-utils';
describe(`Supported file formats (e2e)`, () => {
let app: INestApplication;
let server: any;
let admin: LoginResponseDto;
@ -170,8 +168,11 @@ describe(`Supported file formats (e2e)`, () => {
const testsToRun = formatTests.filter((formatTest) => formatTest.runTest);
beforeAll(async () => {
app = await createTestApp(true);
server = app.getHttpServer();
[server] = await testApp.create({ jobs: true });
});
afterAll(async () => {
await testApp.teardown();
});
beforeEach(async () => {
@ -181,11 +182,6 @@ describe(`Supported file formats (e2e)`, () => {
await api.userApi.setExternalPath(server, admin.accessToken, admin.userId, '/');
});
afterAll(async () => {
await db.disconnect();
await app.close();
});
it.each(testsToRun)('should import file of format $format', async (testedFormat) => {
const library = await api.libraryApi.create(server, admin.accessToken, {
type: LibraryType.EXTERNAL,