Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
test(collections): deliver the import message only to the hook's handler
Elian Doranf71214a43e29
diff --git a/apps/client/src/widgets/collections/NoteList.spec.tsx b/apps/client/src/widgets/collections/NoteList.spec.tsxindex 5e4e69bddf..9f305b65c1 100644--- a/apps/client/src/widgets/collections/NoteList.spec.tsx+++ b/apps/client/src/widgets/collections/NoteList.spec.tsx@@ -315,6 +315,8 @@ describe("useNoteIds nesting depth", () => {}]});+ // Other modules, such as `services/import.ts`, subscribe as well; only the hook's handlers run.+ const otherHandlers = new Set(wsHandlers);const mountPoint = document.createElement("div");await act(async () => {render(@@ -330,7 +332,9 @@ describe("useNoteIds nesting depth", () => {expect(currentNoteIds).toEqual([ "import-existing", "import-root" ]);await act(async () => {- for (const handler of wsHandlers) {+ const hookHandlers = [ ...wsHandlers ].filter((handler) => !otherHandlers.has(handler));+ expect(hookHandlers).toHaveLength(1);+ for (const handler of hookHandlers) {handler({type: "taskSucceeded",taskType: "importNotes",