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 <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Dec 24, 2024
1 parent 4d8bcf7 commit e3e6b93
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: '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()
Expand Down

0 comments on commit e3e6b93

Please sign in to comment.