fix: resolve remaining typescript errors
This commit is contained in:
1 parent
f4c06cbc95
commit
0576d946c5
3 files changed
+19
-16
No files matched your search
@@ -9,7 +9,6 @@ import sharp from "sharp";
|
|||||||
type ThumbnailRouteContext = Readonly<{ params: Promise<{ assetId: string }> }>;
|
type ThumbnailRouteContext = Readonly<{ params: Promise<{ assetId: string }> }>;
|
||||||
|
|
||||||
type ThumbnailImmich = {
|
type ThumbnailImmich = {
|
||||||
listAlbumsForAsset(assetId: string): Promise<Array<{ id: string }>>;
|
|
||||||
getAlbum(albumId: string): Promise<{ albumThumbnailAssetId: string | null }>;
|
getAlbum(albumId: string): Promise<{ albumThumbnailAssetId: string | null }>;
|
||||||
getAsset(assetId: string): Promise<{ albums: Array<{ id: string }> }>;
|
getAsset(assetId: string): Promise<{ albums: Array<{ id: string }> }>;
|
||||||
getThumbnail(assetId: string): Promise<ImmichBinary>;
|
getThumbnail(assetId: string): Promise<ImmichBinary>;
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ test("0002 preserves dirty rows and reconstructs only provable legacy intents",
|
|||||||
status: "authorized",
|
status: "authorized",
|
||||||
authorizedAt,
|
authorizedAt,
|
||||||
});
|
});
|
||||||
expect(immich.listAlbumsForAsset).not.toHaveBeenCalled();
|
expect(immich.getAlbum).not.toHaveBeenCalled();
|
||||||
expect(immich.getAsset).not.toHaveBeenCalled();
|
expect(immich.getAsset).not.toHaveBeenCalled();
|
||||||
|
|
||||||
const migratedEvents = await testDb.pool.query<{
|
const migratedEvents = await testDb.pool.query<{
|
||||||
|
|||||||
@@ -219,17 +219,21 @@ test("requires an active grant for the exact requested album", async () => {
|
|||||||
test("rechecks exact album membership after database locks before inserting", async () => {
|
test("rechecks exact album membership after database locks before inserting", async () => {
|
||||||
const editorialId = await seedEditorial();
|
const editorialId = await seedEditorial();
|
||||||
const { usageService, immich } = createServices();
|
const { usageService, immich } = createServices();
|
||||||
immich.listAlbumsForAsset
|
immich.getAsset
|
||||||
.mockResolvedValueOnce([
|
.mockResolvedValueOnce({
|
||||||
{
|
id: assetId,
|
||||||
id: albumId,
|
type: "IMAGE" as const,
|
||||||
albumName: "Presse 2026",
|
originalFileName: "jubel.jpg",
|
||||||
description: null,
|
originalMimeType: "image/jpeg",
|
||||||
albumThumbnailAssetId: assetId,
|
albums: [{ id: albumId }],
|
||||||
assetCount: 1,
|
})
|
||||||
},
|
.mockResolvedValueOnce({
|
||||||
])
|
id: assetId,
|
||||||
.mockResolvedValueOnce([]);
|
type: "IMAGE" as const,
|
||||||
|
originalFileName: "jubel.jpg",
|
||||||
|
originalMimeType: "image/jpeg",
|
||||||
|
albums: [],
|
||||||
|
});
|
||||||
|
|
||||||
await expect(usageService.createNewUsage(newInput(editorialId))).rejects.toMatchObject({
|
await expect(usageService.createNewUsage(newInput(editorialId))).rejects.toMatchObject({
|
||||||
code: "ASSET_NOT_IN_ALBUM",
|
code: "ASSET_NOT_IN_ALBUM",
|
||||||
@@ -238,7 +242,7 @@ test("rechecks exact album membership after database locks before inserting", as
|
|||||||
.select({ value: count() })
|
.select({ value: count() })
|
||||||
.from(usages)
|
.from(usages)
|
||||||
.where(eq(usages.editorialAccountId, editorialId));
|
.where(eq(usages.editorialAccountId, editorialId));
|
||||||
expect(immich.listAlbumsForAsset).toHaveBeenCalledTimes(2);
|
expect(immich.getAlbum).toHaveBeenCalledTimes(2);
|
||||||
expect(usageCount.value).toBe(0);
|
expect(usageCount.value).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -292,7 +296,7 @@ test("returns a winner committed while waiting before later mutable state is che
|
|||||||
authorizedAt: winner.authorizedAt,
|
authorizedAt: winner.authorizedAt,
|
||||||
billable: true,
|
billable: true,
|
||||||
});
|
});
|
||||||
expect(immich.listAlbumsForAsset).toHaveBeenCalledTimes(1);
|
expect(immich.getAlbum).toHaveBeenCalledTimes(1);
|
||||||
expect(immich.getAsset).toHaveBeenCalledTimes(1);
|
expect(immich.getAsset).toHaveBeenCalledTimes(1);
|
||||||
} finally {
|
} finally {
|
||||||
await locker.query("rollback");
|
await locker.query("rollback");
|
||||||
@@ -334,7 +338,7 @@ test("reports a conflicting winner committed while waiting before later state er
|
|||||||
await locker.query("commit");
|
await locker.query("commit");
|
||||||
|
|
||||||
await expect(pending).rejects.toMatchObject({ code: "IDEMPOTENCY_CONFLICT" });
|
await expect(pending).rejects.toMatchObject({ code: "IDEMPOTENCY_CONFLICT" });
|
||||||
expect(immich.listAlbumsForAsset).toHaveBeenCalledTimes(1);
|
expect(immich.getAlbum).toHaveBeenCalledTimes(1);
|
||||||
expect(immich.getAsset).toHaveBeenCalledTimes(1);
|
expect(immich.getAsset).toHaveBeenCalledTimes(1);
|
||||||
} finally {
|
} finally {
|
||||||
await locker.query("rollback");
|
await locker.query("rollback");
|
||||||
|
|||||||
Reference in new issue
Block a user