mirror of
https://github.com/immich-app/immich.git
synced 2026-03-22 14:29:26 +03:00
fix: resolve medium test asset paths relative to file location (#26683)
This commit is contained in:
@@ -3,6 +3,7 @@ import { Insertable, Kysely } from 'kysely';
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { createHash, randomBytes } from 'node:crypto';
|
import { createHash, randomBytes } from 'node:crypto';
|
||||||
import { Stats } from 'node:fs';
|
import { Stats } from 'node:fs';
|
||||||
|
import { resolve } from 'node:path';
|
||||||
import { Writable } from 'node:stream';
|
import { Writable } from 'node:stream';
|
||||||
import { AssetFace } from 'src/database';
|
import { AssetFace } from 'src/database';
|
||||||
import { AuthDto, LoginResponseDto } from 'src/dtos/auth.dto';
|
import { AuthDto, LoginResponseDto } from 'src/dtos/auth.dto';
|
||||||
@@ -78,6 +79,9 @@ import { factory, newDate, newEmbedding, newUuid } from 'test/small.factory';
|
|||||||
import { automock, wait } from 'test/utils';
|
import { automock, wait } from 'test/utils';
|
||||||
import { Mocked } from 'vitest';
|
import { Mocked } from 'vitest';
|
||||||
|
|
||||||
|
// eslint-disable-next-line unicorn/prefer-module
|
||||||
|
export const testAssetsDir = resolve(__dirname, '../../e2e/test-assets');
|
||||||
|
|
||||||
interface ClassConstructor<T = any> extends Function {
|
interface ClassConstructor<T = any> extends Function {
|
||||||
new (...args: any[]): T;
|
new (...args: any[]): T;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Kysely } from 'kysely';
|
|||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { DB } from 'src/schema';
|
import { DB } from 'src/schema';
|
||||||
import { ExifTestContext } from 'test/medium.factory';
|
import { ExifTestContext, testAssetsDir } from 'test/medium.factory';
|
||||||
import { getKyselyDB } from 'test/utils';
|
import { getKyselyDB } from 'test/utils';
|
||||||
|
|
||||||
let database: Kysely<DB>;
|
let database: Kysely<DB>;
|
||||||
@@ -11,7 +11,7 @@ const setup = async (testAssetPath: string) => {
|
|||||||
const ctx = new ExifTestContext(database);
|
const ctx = new ExifTestContext(database);
|
||||||
|
|
||||||
const { user } = await ctx.newUser();
|
const { user } = await ctx.newUser();
|
||||||
const originalPath = resolve(`../e2e/test-assets/${testAssetPath}`);
|
const originalPath = resolve(testAssetsDir, testAssetPath);
|
||||||
const { asset } = await ctx.newAsset({ ownerId: user.id, originalPath });
|
const { asset } = await ctx.newAsset({ ownerId: user.id, originalPath });
|
||||||
|
|
||||||
return { ctx, sut: ctx.sut, asset };
|
return { ctx, sut: ctx.sut, asset };
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { DB } from 'src/schema';
|
import { DB } from 'src/schema';
|
||||||
import { ExifTestContext } from 'test/medium.factory';
|
import { ExifTestContext, testAssetsDir } from 'test/medium.factory';
|
||||||
import { getKyselyDB } from 'test/utils';
|
import { getKyselyDB } from 'test/utils';
|
||||||
|
|
||||||
let database: Kysely<DB>;
|
let database: Kysely<DB>;
|
||||||
@@ -10,7 +10,7 @@ const setup = async (testAssetPath: string) => {
|
|||||||
const ctx = new ExifTestContext(database);
|
const ctx = new ExifTestContext(database);
|
||||||
|
|
||||||
const { user } = await ctx.newUser();
|
const { user } = await ctx.newUser();
|
||||||
const originalPath = resolve(`../e2e/test-assets/${testAssetPath}`);
|
const originalPath = resolve(testAssetsDir, testAssetPath);
|
||||||
const { asset } = await ctx.newAsset({ ownerId: user.id, originalPath });
|
const { asset } = await ctx.newAsset({ ownerId: user.id, originalPath });
|
||||||
|
|
||||||
return { ctx, sut: ctx.sut, asset };
|
return { ctx, sut: ctx.sut, asset };
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Kysely } from 'kysely';
|
import { Kysely } from 'kysely';
|
||||||
import { resolve } from 'node:path';
|
import { resolve } from 'node:path';
|
||||||
import { DB } from 'src/schema';
|
import { DB } from 'src/schema';
|
||||||
import { ExifTestContext } from 'test/medium.factory';
|
import { ExifTestContext, testAssetsDir } from 'test/medium.factory';
|
||||||
import { getKyselyDB } from 'test/utils';
|
import { getKyselyDB } from 'test/utils';
|
||||||
|
|
||||||
let database: Kysely<DB>;
|
let database: Kysely<DB>;
|
||||||
@@ -10,7 +10,7 @@ const setup = async (testAssetPath: string) => {
|
|||||||
const ctx = new ExifTestContext(database);
|
const ctx = new ExifTestContext(database);
|
||||||
|
|
||||||
const { user } = await ctx.newUser();
|
const { user } = await ctx.newUser();
|
||||||
const originalPath = resolve(`../e2e/test-assets/${testAssetPath}`);
|
const originalPath = resolve(testAssetsDir, testAssetPath);
|
||||||
const { asset } = await ctx.newAsset({ ownerId: user.id, originalPath });
|
const { asset } = await ctx.newAsset({ ownerId: user.id, originalPath });
|
||||||
|
|
||||||
return { ctx, sut: ctx.sut, asset };
|
return { ctx, sut: ctx.sut, asset };
|
||||||
|
|||||||
Reference in New Issue
Block a user