@@ -4476,6 +4476,77 @@ 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+ await account1 . sync ( )
4518+ expect ( account1 . getData ( ) . error ) . to . not . be . ok
4519+
4520+ const serverTree = await getAllBookmarks ( account1 )
4521+ expectTreeEqual (
4522+ serverTree ,
4523+ new Folder ( {
4524+ title : serverTree . title ,
4525+ children : [
4526+ new Folder ( {
4527+ title : 'unrelated' ,
4528+ children : [ ] ,
4529+ } ) ,
4530+ new Folder ( {
4531+ title : 'shared' ,
4532+ children : [
4533+ new Bookmark ( { title : 'from account 1' , url : 'https://account1.example/' } ) ,
4534+ new Bookmark ( { title : 'from account 2' , url : 'https://account2.example/' } ) ,
4535+ ]
4536+ } )
4537+ ]
4538+ } ) ,
4539+ false ,
4540+ false
4541+ )
4542+
4543+ const tree1 = await account1 . localTree . getBookmarksTree ( true )
4544+ const tree2 = await account2 . localTree . getBookmarksTree ( true )
4545+ tree1 . title = serverTree . title
4546+ tree2 . title = serverTree . title
4547+ expectTreeEqual ( tree1 , serverTree , false , false )
4548+ expectTreeEqual ( tree2 , serverTree , false , false )
4549+ } )
44794550 it ( 'should handle concurrent hierarchy reversals' , async function ( ) {
44804551 const localRoot = account1 . getData ( ) . localRoot
44814552 const aFolder = await browser . bookmarks . create ( {
0 commit comments