From e3e6b930706f2821988416b5098fe64e0fc16918 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 24 Dec 2024 12:29:40 +0100 Subject: [PATCH] test: update the server on local changes of url collisions Signed-off-by: Marcel Klehr --- src/test/test.js | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/test/test.js b/src/test/test.js index 0917d04f39..28cc3e8b6a 100644 --- a/src/test/test.js +++ b/src/test/test.js @@ -543,6 +543,67 @@ describe('Floccus', function() { false ) }) + it('should update the server on local changes of url collisions', async function() { + if (ACCOUNT_DATA.noCache) { + return this.skip() + } + + const localRoot = account.getData().localRoot + const fooFolder = await browser.bookmarks.create({ + title: 'foo', + parentId: localRoot + }) + const barFolder = await browser.bookmarks.create({ + title: 'bar', + parentId: fooFolder.id + }) + const bookmark1 = await browser.bookmarks.create({ + title: 'ur1l', + url: 'http://ur1.l/', + parentId: fooFolder.id + }) + const bookmark2 = await browser.bookmarks.create({ + title: 'url', + url: 'http://ur.l/', + parentId: barFolder.id + }) + await account.sync() // propagate to server + expect(account.getData().error).to.not.be.ok + + const newData = { url: 'http://ur.l/' } + await browser.bookmarks.update(bookmark1.id, newData) + await account.sync() // update on server + expect(account.getData().error).to.not.be.ok + + const tree = await getAllBookmarks(account) + expectTreeEqual( + tree, + new Folder({ + title: tree.title, + children: [ + new Folder({ + title: 'foo', + children: [ + new Folder({ + title: 'bar', + children: [ + new Bookmark({ + title: bookmark2.title, + url: bookmark2.url + }) + ] + }), + new Bookmark({ + title: ACCOUNT_DATA.type === 'nextcloud-bookmarks' ? bookmark2.title : bookmark1.title, + url: newData.url + }), + ] + }) + ] + }), + false + ) + }) it('should update the server on local removals', async function() { if (ACCOUNT_DATA.noCache) { return this.skip()