Skip to content

Commit

Permalink
test: Should sync empty folders
Browse files Browse the repository at this point in the history
see #1723

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Sep 20, 2024
1 parent eb2903a commit 7c948c4
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,44 @@ describe('Floccus', function() {
false
)
})
it('should create empty local folders on the server', async function() {
expect(
(await getAllBookmarks(account)).children
).to.have.lengthOf(0)

const localRoot = account.getData().localRoot
const fooFolder = await browser.bookmarks.create({
title: 'foo',
parentId: localRoot
})
await browser.bookmarks.create({
title: 'bar',
parentId: fooFolder.id
})
await account.sync()
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: [
]
})
]
})
]
}),
false
)
})
it('should create local javascript bookmarks on the server', async function() {
expect(
(await getAllBookmarks(account)).children
Expand Down Expand Up @@ -608,6 +646,38 @@ describe('Floccus', function() {
false
)
})
it('should create empty server folders locally', async function() {
const adapter = account.server
const serverTree = await getAllBookmarks(account)
await withSyncConnection(account, async() => {
const fooFolderId = await adapter.createFolder(new Folder({parentId: serverTree.id, title: 'foo'}))
await adapter.createFolder(new Folder({parentId: fooFolderId, title: 'bar'}))
})

await account.sync()
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: [
]
})
]
})
]
}),
false
)
})
it('should update local bookmarks on server changes', async function() {
if (ACCOUNT_DATA.noCache) {
return this.skip()
Expand Down

0 comments on commit 7c948c4

Please sign in to comment.