Skip to content

Build your personal knowledge base with Trilium Notes

fix(test): narrow branchId before exportBranchToZipFile in zip export spec

Elian Doran72b680c3f939
diff --git a/packages/trilium-core/src/services/export/zip.spec.ts b/packages/trilium-core/src/services/export/zip.spec.ts
index f74caa468f..f1ab9f77ce 100644
--- a/packages/trilium-core/src/services/export/zip.spec.ts
+++ b/packages/trilium-core/src/services/export/zip.spec.ts
@@ -456,9 +456,13 @@ describe.skipIf(isBrowserRuntime)("zip export (real DB)", () => {
it("streams a subtree export for the given branch to a file path", async () => {
const { note, branch } = createNote("root", { title: "BranchFileExport", content: "<p>branch to file</p>" });
const zipPath = join(tempDir, `branch-export-${note.noteId}.zip`);
+ const { branchId } = branch;
+ if (!branchId) {
+ throw new Error("branch was not saved");
+ }
await getContext().init(() =>
- zip.exportBranchToZipFile(branch.branchId, "html", zipPath, "no-progress-reporting")
+ zip.exportBranchToZipFile(branchId, "html", zipPath, "no-progress-reporting")
);
const buffer = readFileSync(zipPath);