From 846aae312ed52aa2a1af863d0d0ac0bbd3dea15c Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Fri, 26 Jul 2024 15:24:17 +0500 Subject: [PATCH] core: fix backup tests --- packages/core/__tests__/backup.test.js | 27 ++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/core/__tests__/backup.test.js b/packages/core/__tests__/backup.test.js index ab4bff8b8..f4f5e637a 100644 --- a/packages/core/__tests__/backup.test.js +++ b/packages/core/__tests__/backup.test.js @@ -24,7 +24,10 @@ test("export backup", () => notebookTest().then(async ({ db }) => { const id = await db.notes.add(TEST_NOTE); const exp = []; - for await (const file of db.backup.export("node", false)) { + for await (const file of db.backup.export({ + type: "node", + encrypt: false + })) { exp.push(file); } @@ -49,7 +52,10 @@ test("export encrypted backup", () => await db.notes.add(TEST_NOTE); const exp = []; - for await (const file of db.backup.export("node", true)) { + for await (const file of db.backup.export({ + type: "node", + encrypt: true + })) { exp.push(file); } @@ -67,7 +73,10 @@ test("export encrypted backup", () => test("import backup", async () => { const { db, id } = await notebookTest(); const exp = []; - for await (const file of db.backup.export("node", false)) { + for await (const file of db.backup.export({ + type: "node", + encrypt: false + })) { exp.push(file); } @@ -82,12 +91,15 @@ test("import encrypted backup", async () => { await db.notes.add(TEST_NOTE); const exp = []; - for await (const file of db.backup.export("node", true)) { + for await (const file of db.backup.export({ + type: "node", + encrypt: true + })) { exp.push(file); } const db2 = await databaseTest(); - await db2.backup.import(JSON.parse(exp[1].data), "password"); + await db2.backup.import(JSON.parse(exp[1].data), { password: "password" }); expect((await db2.notebooks.notebook(id)).id).toBe(id); }); @@ -96,7 +108,10 @@ test("import tempered backup", () => await db.notes.add(TEST_NOTE); const exp = []; - for await (const file of db.backup.export("node", false)) { + for await (const file of db.backup.export({ + type: "node", + encrypt: false + })) { exp.push(file); }