@@ -80,7 +80,7 @@ describe('Floccus', function() {
8080 account1 . onSyncProcessCreated = armInterrupt
8181 account2 . onSyncProcessCreated = armInterrupt
8282
83- if ( ACCOUNT_DATA . type . startsWith ( 'fake' ) ) {
83+ if ( ACCOUNT_DATA . type === 'fake' ) {
8484 // Wire both accounts to the same fake db
8585 // We do not set the cache properties to the same object, because we want to only write onSynComplete
8686 let fakeServerDb = new Folder (
@@ -109,6 +109,36 @@ describe('Floccus', function() {
109109 } )
110110 account2 . server . __defineGetter__ ( 'highestId' , ( ) => account1 . server . highestId )
111111 }
112+ if ( ACCOUNT_DATA . type === 'fake-nc-bookmarks' ) {
113+ // Wire both accounts to the same fake db
114+ // We do not set the cache properties to the same object, because we want to only write onSynComplete
115+ let fakeServerDb = new Folder ( {
116+ id : '' ,
117+ title : 'root' ,
118+ location : 'Server' ,
119+ } )
120+ account1 . server . __defineSetter__ ( 'bookmarksCache' , ( db ) => {
121+ fakeServerDb = db
122+ } )
123+ account2 . server . __defineSetter__ ( 'bookmarksCache' , ( db ) => {
124+ fakeServerDb = db
125+ } )
126+ account1 . server . __defineGetter__ (
127+ 'bookmarksCache' ,
128+ ( ) => fakeServerDb
129+ )
130+ account2 . server . __defineGetter__ (
131+ 'bookmarksCache' ,
132+ ( ) => fakeServerDb
133+ )
134+ account2 . server . __defineSetter__ ( 'highestId' , ( id ) => {
135+ account1 . server . highestId = id
136+ } )
137+ account2 . server . __defineGetter__ (
138+ 'highestId' ,
139+ ( ) => account1 . server . highestId
140+ )
141+ }
112142 if ( ACCOUNT_DATA . noCache ) {
113143 account1 . storage . setCache = ( ) => {
114144 // noop
@@ -1098,8 +1128,7 @@ describe('Floccus', function() {
10981128 serverTreeAfterInit = null
10991129 }
11001130 } )
1101- let interruptBenchmark
1102- it ( 'should handle fuzzed changes with deletions from two clients with interrupts' + ( ACCOUNT_DATA . type === 'fake' ? ' (with caching)' : '' ) , interruptBenchmark = async function ( ) {
1131+ it ( 'should handle fuzzed changes with deletions from two clients with interrupts' , async function ( ) {
11031132 const localResource1 = await account1 . getResource ( )
11041133 const localRoot1 = ( await localResource1 . getBookmarksTree ( ) ) . id
11051134 let bookmarks1 = [ ]
@@ -1355,21 +1384,6 @@ describe('Floccus', function() {
13551384 }
13561385 } )
13571386
1358- if ( ACCOUNT_DATA . type === 'fake' ) {
1359- it ( 'should handle fuzzed changes with deletions from two clients with interrupts (no caching adapter)' , async function ( ) {
1360- // Wire both accounts to the same fake db
1361- // We set the cache properties to the same object, because we want to simulate nextcloud-bookmarks
1362- const bmDb = account1 . server . bookmarksCache = account2 . server . bookmarksCache = new Folder (
1363- { id : '' , title : 'root' , location : 'Server' }
1364- )
1365- account1 . server . onSyncStart = function ( ) { this . bookmarksCache = bmDb }
1366- account1 . server . isAtomic = ( ) => false
1367- account2 . server . onSyncStart = function ( ) { this . bookmarksCache = bmDb }
1368- account2 . server . isAtomic = ( ) => false
1369- await interruptBenchmark ( )
1370- } )
1371- }
1372-
13731387 it ( 'unidirectional should handle fuzzed changes from two clients' , async function ( ) {
13741388 await account2 . setData ( { strategy : 'slave' } )
13751389
0 commit comments