Skip to content

Commit

Permalink
fix: Make it pass tests on firefox
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Jul 28, 2024
1 parent 11b9849 commit 97f1e73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/Diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export default class Diff<L1 extends TItemLocation, L2 extends TItemLocation, A
newAction.payload.id = Mappings.mapId(mappingsSnapshot, action.payload, targetLocation)
}

if (oldItem && targetLocation !== ItemLocation.SERVER && action.type !== ActionType.MOVE && action.type !== ActionType.UPDATE) {
if (oldItem && targetLocation !== ItemLocation.SERVER && action.type !== ActionType.MOVE) {
newAction.payload.parentId = action.oldItem.parentId
newAction.oldItem.parentId = action.payload.parentId
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/strategies/Default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export default class SyncProcess {
Logger.log('Retrieving server tree')
const serverTreeRoot = await this.server.getBookmarksTree()
Logger.log('Filtering out invalid server bookmarks')
this.filterOutInvalidBookmarks(this.serverTreeRoot)
this.filterOutInvalidBookmarks(serverTreeRoot)

if (this.canceled) {
throw new CancelledSyncError()
Expand Down
8 changes: 7 additions & 1 deletion src/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3725,18 +3725,21 @@ describe('Floccus', function() {
expectTreeEqual(
tree1AfterFirstSync,
tree1,
false,
false
)
serverTreeAfterFirstSync.title = tree1.title
expectTreeEqual(
serverTreeAfterFirstSync,
tree1,
false,
false
)
tree2AfterFirstSync.title = tree1.title
expectTreeEqual(
tree2AfterFirstSync,
tree1,
false,
false
)
console.log('First round ok')
Expand Down Expand Up @@ -3771,6 +3774,7 @@ describe('Floccus', function() {
expectTreeEqual(
serverTreeAfterThirdSync,
tree1AfterThirdSync,
false,
false
)

Expand All @@ -3789,12 +3793,14 @@ describe('Floccus', function() {
expectTreeEqual(
serverTreeAfterFinalSync,
tree2AfterFinalSync,
false,
false
)
tree1AfterThirdSync.title = tree2AfterFinalSync.title
expectTreeEqual(
tree2AfterFinalSync,
tree1AfterThirdSync,
false,
false
)
})
Expand Down Expand Up @@ -6095,7 +6101,7 @@ describe('Floccus', function() {
delete account2.server.onSyncStart
delete account2.server.onSyncComplete
await interruptBenchmark()
})
}).retries(3)
}

it('unidirectional should handle fuzzed changes from two clients', async function() {
Expand Down

0 comments on commit 97f1e73

Please sign in to comment.