Skip to content

Commit

Permalink
test: update the server on local changes of url collisions
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Dec 24, 2024
1 parent 4d8bcf7 commit be6beb8
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'ur2l',
url: 'http://ur2.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: ACCOUNT_DATA.type === 'nextcloud-bookmarks' ? bookmark1.title : bookmark2.title,
url: newData.url
})
]
}),
new Bookmark({
title: bookmark1.title,
url: bookmark1.url
}),
]
})
]
}),
false
)
})
it('should update the server on local removals', async function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
Expand Down

0 comments on commit be6beb8

Please sign in to comment.