From 4a580d713621f99abb8baabc9b847ce039d44842 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 4 Oct 2025 13:40:24 +0100 Subject: feat: Revamp import experience (#2001) * WIP: import v2 * remove new session button * don't redirect after import * store and lint to root list * models + tests * redesign the progress * simplify the import session for ow * drop status from session schema * split the import session page * i18n * fix test * remove pagination * fix some colors in darkmode * one last fix * add privacy filter * privacy check * fix interactivity of import progress * fix test --- packages/shared/import-export/importer.test.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'packages/shared/import-export/importer.test.ts') diff --git a/packages/shared/import-export/importer.test.ts b/packages/shared/import-export/importer.test.ts index 2ea63846..00f892a9 100644 --- a/packages/shared/import-export/importer.test.ts +++ b/packages/shared/import-export/importer.test.ts @@ -85,6 +85,8 @@ describe("importBookmarksFromFile", () => { }, ); + const createImportSession = vi.fn(async () => ({ id: "session-1" })); + const progress: number[] = []; const res = await importBookmarksFromFile( { @@ -96,6 +98,7 @@ describe("importBookmarksFromFile", () => { createBookmark, addBookmarkToLists, updateBookmarkTags, + createImportSession, }, onProgress: (d, t) => progress.push(d / t), }, @@ -167,6 +170,7 @@ describe("importBookmarksFromFile", () => { createBookmark: vi.fn(), addBookmarkToLists: vi.fn(), updateBookmarkTags: vi.fn(), + createImportSession: vi.fn(async () => ({ id: "session-1" })), }, }, { parsers }, @@ -174,6 +178,7 @@ describe("importBookmarksFromFile", () => { expect(res).toEqual({ counts: { successes: 0, failures: 0, alreadyExisted: 0, total: 0 }, rootListId: null, + importSessionId: null, }); }); @@ -244,6 +249,8 @@ describe("importBookmarksFromFile", () => { }, ); + const createImportSession = vi.fn(async () => ({ id: "session-1" })); + const progress: number[] = []; const res = await importBookmarksFromFile( { @@ -255,6 +262,7 @@ describe("importBookmarksFromFile", () => { createBookmark, addBookmarkToLists, updateBookmarkTags, + createImportSession, }, onProgress: (d, t) => progress.push(d / t), }, @@ -353,6 +361,8 @@ describe("importBookmarksFromFile", () => { }, ); + const createImportSession = vi.fn(async () => ({ id: "session-1" })); + const progress: number[] = []; const res = await importBookmarksFromFile( { @@ -364,6 +374,7 @@ describe("importBookmarksFromFile", () => { createBookmark, addBookmarkToLists, updateBookmarkTags, + createImportSession, }, onProgress: (d, t) => progress.push(d / t), }, @@ -371,6 +382,7 @@ describe("importBookmarksFromFile", () => { ); expect(res.rootListId).toBe("Imported"); + expect(res.importSessionId).toBe("session-1"); // All bookmarks are created successfully, but 2 fail in post-processing expect(res.counts).toEqual({ -- cgit v1.2.3-70-g09d2