Skip to content

Build your personal knowledge base with Trilium Notes

test(collections): keep the real i18n module behind the collection filter mock

Elian Doran687aea503ce5
diff --git a/apps/client/src/widgets/collections/collection_filter.spec.tsx b/apps/client/src/widgets/collections/collection_filter.spec.tsx
index e96ad0d948..f01e8e4fe8 100644
--- a/apps/client/src/widgets/collections/collection_filter.spec.tsx
+++ b/apps/client/src/widgets/collections/collection_filter.spec.tsx
@@ -15,7 +15,11 @@ import {
type CollectionFilter, CollectionFilterInput, useCollectionFilter
} from "./collection_filter";
-vi.mock("../../services/i18n", () => ({
+// The real module besides `t`, which is left to stand for the text it would return:
+// `command_registry.ts`, reached through `note_autocomplete.ts`, awaits
+// `translationsInitializedPromise`, and a mock without it rejects after the test has passed.
+vi.mock("../../services/i18n", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../../services/i18n")>()),
t: (key: string) => key
}));