Skip to content

Commit

Permalink
test(Scanner): Move stability with same-titled folders
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Nov 24, 2024
1 parent 7142d56 commit fc5702b
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,102 @@ describe('Floccus', function() {
Boolean(account.server.orderFolder)
)
})
it('should move items without confusing folders', async function() {
const localRoot = account.getData().localRoot

const aFolder = await browser.bookmarks.create({
title: 'a',
parentId: localRoot
})
const bFolder = await browser.bookmarks.create({
title: 'b',
parentId: localRoot
})
const dFolder = await browser.bookmarks.create({
title: 'd',
parentId: localRoot
})
const cFolder1 = await browser.bookmarks.create({
title: 'c',
parentId: aFolder.id
})
await browser.bookmarks.create({
title: 'url',
url: 'http://ur.l/',
parentId: cFolder1.id
})
const cFolder2 = await browser.bookmarks.create({
title: 'c',
parentId: bFolder.id
})
await browser.bookmarks.create({
title: 'test',
url: 'http://urrr.l/',
parentId: cFolder2.id
})

await account.sync() // propagate to server
expect(account.getData().error).to.not.be.ok

// move b into a in client
await browser.bookmarks.move(cFolder1.id, { parentId: dFolder.id })
await browser.bookmarks.move(cFolder2.id, { parentId: localRoot })

await account.sync() // propagate to 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: 'a',
children: []
}),
new Folder({
title: 'b',
children: []
}),
new Folder({
title: 'd',
children: [
new Folder({
title: 'c',
children: [
new Bookmark({
title: 'url',
url: 'http://ur.l/',
})
]
})
]
}),
new Folder({
title: 'c',
children: [
new Bookmark({
title: 'test',
url: 'http://urrr.l/',
})
]
}),
]
}),
false,
Boolean(account.server.orderFolder)
)

const localTree = await account.localTree.getBookmarksTree(true)
localTree.title = tree.title
expectTreeEqual(
localTree,
tree,
false,
Boolean(account.server.orderFolder)
)
})
it('should integrate existing items from both sides', async function() {
const localRoot = account.getData().localRoot

Expand Down

0 comments on commit fc5702b

Please sign in to comment.