From 10b6aa198fe4eabf2b3383ae4c55dbc02acc7634 Mon Sep 17 00:00:00 2001 From: Jonatan Heyman Date: Tue, 16 Jul 2024 10:24:15 +0200 Subject: [PATCH] Add test that checks that existing keys are kept in buffer files' metadata --- tests/note-format.spec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/note-format.spec.js b/tests/note-format.spec.js index 70c26f3..ec68b5a 100644 --- a/tests/note-format.spec.js +++ b/tests/note-format.spec.js @@ -46,3 +46,17 @@ block`) const note = NoteFormat.load(bufferData) expect(note.cursors.ranges.length).toBe(3) }) + +test("unknown note metadata keys is kept", async ({ page, browserName }) => { + await heynotePage.setContent(`{"yoda":[123], "formatVersion":"1.0", "cursors":{"ranges":[{"anchor":15,"head":15}],"main":0}} +∞∞∞text +block 1`) + await page.locator("body").pressSequentially("hello") + expect(await heynotePage.getContent()).toBe(` +∞∞∞text +block hello1`) + + const bufferData = await heynotePage.getBufferData() + const note = NoteFormat.load(bufferData) + expect(note.metadata.yoda).toStrictEqual([123]) +}) \ No newline at end of file