@@ -4476,6 +4476,75 @@ describe('Floccus', function() {
44764476 false
44774477 )
44784478 } )
4479+ it ( 'should keep residual creates when merging concurrently created folders' , async function ( ) {
4480+ const localRoot1 = account1 . getData ( ) . localRoot
4481+ const localRoot2 = account2 . getData ( ) . localRoot
4482+
4483+ await browser . bookmarks . create ( {
4484+ title : 'unrelated' ,
4485+ parentId : localRoot1
4486+ } )
4487+
4488+ await account1 . sync ( )
4489+ expect ( account1 . getData ( ) . error ) . to . not . be . ok
4490+ await account2 . sync ( )
4491+ expect ( account2 . getData ( ) . error ) . to . not . be . ok
4492+
4493+ const folder1 = await browser . bookmarks . create ( {
4494+ title : 'shared' ,
4495+ parentId : localRoot1
4496+ } )
4497+ await browser . bookmarks . create ( {
4498+ title : 'from account 1' ,
4499+ url : 'https://account1.example/' ,
4500+ parentId : folder1 . id
4501+ } )
4502+
4503+ const folder2 = await browser . bookmarks . create ( {
4504+ title : 'shared' ,
4505+ parentId : localRoot2
4506+ } )
4507+ await browser . bookmarks . create ( {
4508+ title : 'from account 2' ,
4509+ url : 'https://account2.example/' ,
4510+ parentId : folder2 . id
4511+ } )
4512+
4513+ await account1 . sync ( )
4514+ expect ( account1 . getData ( ) . error ) . to . not . be . ok
4515+ await account2 . sync ( )
4516+ expect ( account2 . getData ( ) . error ) . to . not . be . ok
4517+
4518+ const serverTree = await getAllBookmarks ( account1 )
4519+ expectTreeEqual (
4520+ serverTree ,
4521+ new Folder ( {
4522+ title : serverTree . title ,
4523+ children : [
4524+ new Folder ( {
4525+ title : 'unrelated' ,
4526+ children : [ ] ,
4527+ } ) ,
4528+ new Folder ( {
4529+ title : 'shared' ,
4530+ children : [
4531+ new Bookmark ( { title : 'from account 1' , url : 'https://account1.example/' } ) ,
4532+ new Bookmark ( { title : 'from account 2' , url : 'https://account2.example/' } ) ,
4533+ ]
4534+ } )
4535+ ]
4536+ } ) ,
4537+ false ,
4538+ false
4539+ )
4540+
4541+ const tree1 = await account1 . localTree . getBookmarksTree ( true )
4542+ const tree2 = await account2 . localTree . getBookmarksTree ( true )
4543+ tree1 . title = serverTree . title
4544+ tree2 . title = serverTree . title
4545+ expectTreeEqual ( tree1 , serverTree , false , false )
4546+ expectTreeEqual ( tree2 , serverTree , false , false )
4547+ } )
44794548 it ( 'should handle concurrent hierarchy reversals' , async function ( ) {
44804549 const localRoot = account1 . getData ( ) . localRoot
44814550 const aFolder = await browser . bookmarks . create ( {
0 commit comments