diff options
Diffstat (limited to '')
| -rw-r--r-- | packages/trpc/routers/importSessions.test.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/trpc/routers/importSessions.test.ts b/packages/trpc/routers/importSessions.test.ts index b28d1421..9ef0de6f 100644 --- a/packages/trpc/routers/importSessions.test.ts +++ b/packages/trpc/routers/importSessions.test.ts @@ -1,6 +1,8 @@ +import { eq } from "drizzle-orm"; import { beforeEach, describe, expect, test } from "vitest"; import { z } from "zod"; +import { bookmarks } from "@karakeep/db/schema"; import { BookmarkTypes, zNewBookmarkRequestSchema, @@ -117,6 +119,34 @@ describe("ImportSessions Routes", () => { }); }); + test<CustomTestContext>("marks text-only imports as completed when tagging succeeds", async ({ + apiCallers, + db, + }) => { + const api = apiCallers[0]; + const session = await api.importSessions.createImportSession({ + name: "Text Import Session", + }); + const bookmarkId = await createTestBookmark(api, session.id); + + await db + .update(bookmarks) + .set({ taggingStatus: "success" }) + .where(eq(bookmarks.id, bookmarkId)); + + const stats = await api.importSessions.getImportSessionStats({ + importSessionId: session.id, + }); + + expect(stats).toMatchObject({ + completedBookmarks: 1, + pendingBookmarks: 0, + failedBookmarks: 0, + totalBookmarks: 1, + status: "completed", + }); + }); + test<CustomTestContext>("list import sessions returns all sessions", async ({ apiCallers, }) => { |
