mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	refactor: e2e tests (#4536)
This commit is contained in:
		| @@ -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 () => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user