@@ -5720,29 +5720,36 @@ describe('Floccus', function() {
57205720 let account1 , account2 , RUN_INTERRUPTS = false
57215721 let timeouts = [ ]
57225722 let i = 0
5723+ let timer = null
57235724 const setInterrupt = ( ) => {
57245725 if ( ! timeouts . length ) {
57255726 timeouts = new Array ( 1000 ) . fill ( 0 ) . map ( ( ) =>
57265727 ACCOUNT_DATA . type === 'nextcloud-bookmarks' ? random . int ( 50000 , 150000 ) : random . int ( 100 , 3000 )
57275728 )
57285729 }
57295730 const timeout = timeouts [ ( i ++ ) % 1000 ]
5730- setTimeout ( ( ) => {
5731+ timer = setTimeout ( ( ) => {
57315732 if ( RUN_INTERRUPTS ) {
57325733 console . log ( 'INTERRUPT! (after ' + timeout + ')' )
57335734 account1 . cancelSync ( )
57345735 account2 . cancelSync ( )
5735- setInterrupt ( )
57365736 }
5737+ setInterrupt ( )
57375738 } , timeout )
57385739 }
5740+ const stopInterrupts = ( ) => {
5741+ clearTimeout ( timer )
5742+ timeouts = [ ]
5743+ i = 0
5744+ }
57395745
57405746 beforeEach ( 'set up accounts' , async function ( ) {
57415747 let _expectTreeEqual = expectTreeEqual
57425748 expectTreeEqual = ( tree1 , tree2 , ignoreEmptyFolders , checkOrder ) => _expectTreeEqual ( tree1 , tree2 , ignoreEmptyFolders , ! ! checkOrder )
57435749
57445750 // reset random seed
57455751 random . use ( seedrandom ( SEED ) )
5752+ stopInterrupts ( )
57465753
57475754 account1 = await Account . create ( { ...ACCOUNT_DATA , failsafe : false } )
57485755 await account1 . init ( )
@@ -5795,6 +5802,7 @@ describe('Floccus', function() {
57955802 } )
57965803 afterEach ( 'clean up accounts' , async function ( ) {
57975804 RUN_INTERRUPTS = false
5805+ stopInterrupts ( )
57985806 await browser . bookmarks . removeTree ( account1 . getData ( ) . localRoot )
57995807 if ( ACCOUNT_DATA . type === 'git' ) {
58005808 await account1 . server . clearServer ( )
@@ -5824,6 +5832,7 @@ describe('Floccus', function() {
58245832 throw new Error ( 'Google Drive sync left more than one file behind' )
58255833 }
58265834 }
5835+ await browser . bookmarks . removeTree ( account1 . getData ( ) . localRoot )
58275836 await account1 . delete ( )
58285837 await browser . bookmarks . removeTree ( account2 . getData ( ) . localRoot )
58295838 await account2 . delete ( )
@@ -6690,7 +6699,7 @@ describe('Floccus', function() {
66906699 }
66916700 } )
66926701 let interruptBenchmark
6693- it . skip ( 'should handle fuzzed changes with deletions from two clients with interrupts' + ( ACCOUNT_DATA . type === 'fake' ? ' (with caching)' : '' ) , interruptBenchmark = async function ( ) {
6702+ it ( 'should handle fuzzed changes with deletions from two clients with interrupts' + ( ACCOUNT_DATA . type === 'fake' ? ' (with caching)' : '' ) , interruptBenchmark = async function ( ) {
66946703 const localRoot = account1 . getData ( ) . localRoot
66956704 let bookmarks1 = [ ]
66966705 let folders1 = [ ]
@@ -6927,16 +6936,16 @@ describe('Floccus', function() {
69276936 } )
69286937
69296938 if ( ACCOUNT_DATA . type === 'fake' ) {
6930- it . skip ( 'should handle fuzzed changes with deletions from two clients with interrupts (no caching adapter)' , async function ( ) {
6939+ it ( 'should handle fuzzed changes with deletions from two clients with interrupts (no caching adapter)' , async function ( ) {
69316940 // Wire both accounts to the same fake db
69326941 // We set the cache properties to the same object, because we want to simulate nextcloud-bookmarks
69336942 account1 . server . bookmarksCache = account2 . server . bookmarksCache = new Folder (
69346943 { id : '' , title : 'root' , location : 'Server' }
69356944 )
6936- delete account1 . server . onSyncStart
6937- delete account1 . server . onSyncComplete
6938- delete account2 . server . onSyncStart
6939- delete account2 . server . onSyncComplete
6945+ account1 . server . onSyncStart = null
6946+ account1 . server . onSyncComplete = null
6947+ account2 . server . onSyncStart = null
6948+ account2 . server . onSyncComplete = null
69406949 await interruptBenchmark ( )
69416950 } )
69426951 }
0 commit comments