|
@@ -1,5 +1,6 @@
|
|
import { JobService, LoginResponseDto } from '@app/domain';
|
|
import { JobService, LoginResponseDto } from '@app/domain';
|
|
import { AppModule } from '@app/immich/app.module';
|
|
import { AppModule } from '@app/immich/app.module';
|
|
|
|
+import { RedisIoAdapter } from '@app/infra';
|
|
import { LibraryType } from '@app/infra/entities';
|
|
import { LibraryType } from '@app/infra/entities';
|
|
import { INestApplication, Logger } from '@nestjs/common';
|
|
import { INestApplication, Logger } from '@nestjs/common';
|
|
import { Test, TestingModule } from '@nestjs/testing';
|
|
import { Test, TestingModule } from '@nestjs/testing';
|
|
@@ -31,6 +32,8 @@ describe('File format (e2e)', () => {
|
|
|
|
|
|
app = moduleFixture.createNestApplication();
|
|
app = moduleFixture.createNestApplication();
|
|
|
|
|
|
|
|
+ app.useWebSocketAdapter(new RedisIoAdapter(app));
|
|
|
|
+
|
|
await app.init();
|
|
await app.init();
|
|
app.enableShutdownHooks();
|
|
app.enableShutdownHooks();
|
|
server = app.getHttpServer();
|
|
server = app.getHttpServer();
|
|
@@ -40,6 +43,14 @@ describe('File format (e2e)', () => {
|
|
await moduleFixture.get(MicroAppService).init(true);
|
|
await moduleFixture.get(MicroAppService).init(true);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ afterAll(async () => {
|
|
|
|
+ console.log(await jobService.getAllJobsStatus());
|
|
|
|
+ await jobService.obliterateAll(true);
|
|
|
|
+ await app.close();
|
|
|
|
+ await moduleFixture.close();
|
|
|
|
+ await db.disconnect();
|
|
|
|
+ });
|
|
|
|
+
|
|
beforeEach(async () => {
|
|
beforeEach(async () => {
|
|
// We expect https://github.com/etnoy/immich-test-assets to be cloned into the e2e/assets folder
|
|
// We expect https://github.com/etnoy/immich-test-assets to be cloned into the e2e/assets folder
|
|
|
|
|
|
@@ -66,13 +77,19 @@ describe('File format (e2e)', () => {
|
|
|
|
|
|
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
|
const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
|
expect(assets).toHaveLength(1);
|
|
expect(assets).toHaveLength(1);
|
|
|
|
+ console.log(assets);
|
|
|
|
+ const jpgAsset = assets[0];
|
|
|
|
+ expect(jpgAsset.type).toBe('image/jpeg');
|
|
|
|
+ expect(jpgAsset.originalFileName).toBe('el_torcal_rocks');
|
|
|
|
+ expect(jpgAsset.exifInfo?.exifImageHeight).toBe(341);
|
|
|
|
+ expect(jpgAsset.exifInfo?.exifImageWidth).toBe(512);
|
|
});
|
|
});
|
|
|
|
|
|
- it('should import a heic file', async () => {
|
|
|
|
|
|
+ it('should import a jpeg file', async () => {
|
|
const library = await api.libraryApi.createLibrary(server, admin.accessToken, {
|
|
const library = await api.libraryApi.createLibrary(server, admin.accessToken, {
|
|
type: LibraryType.EXTERNAL,
|
|
type: LibraryType.EXTERNAL,
|
|
name: 'Library',
|
|
name: 'Library',
|
|
- importPaths: [`${__dirname}/../assets/formats/heic`],
|
|
|
|
|
|
+ importPaths: [`${__dirname}/../assets/formats/jpeg`],
|
|
exclusionPatterns: [],
|
|
exclusionPatterns: [],
|
|
});
|
|
});
|
|
|
|
|
|
@@ -85,11 +102,25 @@ describe('File format (e2e)', () => {
|
|
console.log(assets);
|
|
console.log(assets);
|
|
});
|
|
});
|
|
|
|
|
|
- afterAll(async () => {
|
|
|
|
- console.log(await jobService.getAllJobsStatus());
|
|
|
|
- await jobService.obliterateAll(true);
|
|
|
|
- await app.close();
|
|
|
|
- await moduleFixture.close();
|
|
|
|
- await db.disconnect();
|
|
|
|
|
|
+ it('should import a heic file', async () => {
|
|
|
|
+ const library = await api.libraryApi.createLibrary(server, admin.accessToken, {
|
|
|
|
+ type: LibraryType.EXTERNAL,
|
|
|
|
+ name: 'Library',
|
|
|
|
+ importPaths: [`${__dirname}/../assets/formats/heic`],
|
|
|
|
+ exclusionPatterns: [],
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ await api.libraryApi.scanLibrary(server, admin.accessToken, library.id, {});
|
|
|
|
+
|
|
|
|
+ await waitForQueues(jobService);
|
|
|
|
+
|
|
|
|
+ const assets = await api.assetApi.getAllAssets(server, admin.accessToken);
|
|
|
|
+ expect(assets).toHaveLength(1);
|
|
|
|
+ const heicAsset = assets[0];
|
|
|
|
+ console.log(heicAsset);
|
|
|
|
+ expect(heicAsset.type).toBe('image/heic');
|
|
|
|
+ expect(heicAsset.originalFileName).toBe('IMG_2682');
|
|
|
|
+ expect(heicAsset.duration).toBe(null);
|
|
|
|
+ expect(heicAsset.fileCreatedAt).toBe('2029-03-21T11:04:00.000Z');
|
|
});
|
|
});
|
|
});
|
|
});
|