mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: e2e tests (#4536)
This commit is contained in:
parent
31987bc043
commit
4b59f83288
22 changed files with 189 additions and 201 deletions
|
|
@ -12,7 +12,7 @@ import { AssetEntity, AssetType, SharedLinkType } from '@app/infra/entities';
|
|||
import { INestApplication } from '@nestjs/common';
|
||||
import { api } from '@test/api';
|
||||
import { errorStub, uuidStub } from '@test/fixtures';
|
||||
import { createTestApp, db } from '@test/test-utils';
|
||||
import { db, testApp } from '@test/test-utils';
|
||||
import { randomBytes } from 'crypto';
|
||||
import request from 'supertest';
|
||||
|
||||
|
|
@ -86,12 +86,14 @@ describe(`${AssetController.name} (e2e)`, () => {
|
|||
let asset4: AssetEntity;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await createTestApp();
|
||||
|
||||
server = app.getHttpServer();
|
||||
[server, app] = await testApp.create();
|
||||
assetRepository = app.get<IAssetRepository>(IAssetRepository);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await testApp.teardown();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await db.reset();
|
||||
await api.authApi.adminSignUp(server);
|
||||
|
|
@ -123,11 +125,6 @@ describe(`${AssetController.name} (e2e)`, () => {
|
|||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await db.disconnect();
|
||||
await app.close();
|
||||
});
|
||||
|
||||
describe('POST /asset/upload', () => {
|
||||
it('should require authentication', async () => {
|
||||
const { status, body } = await request(server)
|
||||
|
|
@ -589,9 +586,11 @@ describe(`${AssetController.name} (e2e)`, () => {
|
|||
|
||||
describe('GET /asset/map-marker', () => {
|
||||
beforeEach(async () => {
|
||||
await assetRepository.save({ id: asset1.id, isArchived: true });
|
||||
await assetRepository.upsertExif({ assetId: asset1.id, latitude: 0, longitude: 0 });
|
||||
await assetRepository.upsertExif({ assetId: asset2.id, latitude: 0, longitude: 0 });
|
||||
await Promise.all([
|
||||
assetRepository.save({ id: asset1.id, isArchived: true }),
|
||||
assetRepository.upsertExif({ assetId: asset1.id, latitude: 0, longitude: 0 }),
|
||||
assetRepository.upsertExif({ assetId: asset2.id, latitude: 0, longitude: 0 }),
|
||||
]);
|
||||
});
|
||||
|
||||
it('should require authentication', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue