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,16 +1,10 @@
import { AlbumResponseDto, LoginResponseDto, SharedLinkResponseDto } from '@app/domain';
import { PartnerController } from '@app/immich';
import { LibraryType, SharedLinkType } from '@app/infra/entities';
import { INestApplication } from '@nestjs/common';
import { api } from '@test/api';
import { db } from '@test/db';
import { errorStub, uuidStub } from '@test/fixtures';
import {
IMMICH_TEST_ASSET_PATH,
IMMICH_TEST_ASSET_TEMP_PATH,
createTestApp,
restoreTempFolder,
} from '@test/test-utils';
import { IMMICH_TEST_ASSET_PATH, IMMICH_TEST_ASSET_TEMP_PATH, restoreTempFolder, testApp } from '@test/test-utils';
import { cp } from 'fs/promises';
import request from 'supertest';
@ -22,7 +16,6 @@ const user1Dto = {
};
describe(`${PartnerController.name} (e2e)`, () => {
let app: INestApplication;
let server: any;
let admin: LoginResponseDto;
let user1: LoginResponseDto;
@ -30,8 +23,12 @@ describe(`${PartnerController.name} (e2e)`, () => {
let sharedLink: SharedLinkResponseDto;
beforeAll(async () => {
app = await createTestApp(true);
server = app.getHttpServer();
[server] = await testApp.create({ jobs: true });
});
afterAll(async () => {
await testApp.teardown();
await restoreTempFolder();
});
beforeEach(async () => {
@ -49,12 +46,6 @@ describe(`${PartnerController.name} (e2e)`, () => {
});
});
afterAll(async () => {
await db.disconnect();
await app.close();
await restoreTempFolder();
});
describe('GET /shared-link', () => {
it('should require authentication', async () => {
const { status, body } = await request(server).get('/shared-link');