@@ -3949,7 +3949,6 @@ describe('Floccus', function() {
39493949 }
39503950 } )
39513951 afterEach ( 'clean up accounts' , async function ( ) {
3952- await browser . bookmarks . removeTree ( account1 . getData ( ) . localRoot )
39533952 if ( ACCOUNT_DATA . type === 'git' ) {
39543953 await account1 . server . clearServer ( )
39553954 } else if ( ACCOUNT_DATA . type !== 'fake' ) {
@@ -5720,29 +5719,36 @@ describe('Floccus', function() {
57205719 let account1 , account2 , RUN_INTERRUPTS = false
57215720 let timeouts = [ ]
57225721 let i = 0
5722+ let timer = null
57235723 const setInterrupt = ( ) => {
57245724 if ( ! timeouts . length ) {
57255725 timeouts = new Array ( 1000 ) . fill ( 0 ) . map ( ( ) =>
57265726 ACCOUNT_DATA . type === 'nextcloud-bookmarks' ? random . int ( 50000 , 150000 ) : random . int ( 100 , 3000 )
57275727 )
57285728 }
57295729 const timeout = timeouts [ ( i ++ ) % 1000 ]
5730- setTimeout ( ( ) => {
5730+ timer = setTimeout ( ( ) => {
57315731 if ( RUN_INTERRUPTS ) {
57325732 console . log ( 'INTERRUPT! (after ' + timeout + ')' )
57335733 account1 . cancelSync ( )
57345734 account2 . cancelSync ( )
5735- setInterrupt ( )
57365735 }
5736+ setInterrupt ( )
57375737 } , timeout )
57385738 }
5739+ const stopInterrupts = ( ) => {
5740+ clearTimeout ( timer )
5741+ timeouts = [ ]
5742+ i = 0
5743+ }
57395744
57405745 beforeEach ( 'set up accounts' , async function ( ) {
57415746 let _expectTreeEqual = expectTreeEqual
57425747 expectTreeEqual = ( tree1 , tree2 , ignoreEmptyFolders , checkOrder ) => _expectTreeEqual ( tree1 , tree2 , ignoreEmptyFolders , ! ! checkOrder )
57435748
57445749 // reset random seed
57455750 random . use ( seedrandom ( SEED ) )
5751+ stopInterrupts ( )
57465752
57475753 account1 = await Account . create ( { ...ACCOUNT_DATA , failsafe : false } )
57485754 await account1 . init ( )
@@ -5795,7 +5801,7 @@ describe('Floccus', function() {
57955801 } )
57965802 afterEach ( 'clean up accounts' , async function ( ) {
57975803 RUN_INTERRUPTS = false
5798- await browser . bookmarks . removeTree ( account1 . getData ( ) . localRoot )
5804+ stopInterrupts ( )
57995805 if ( ACCOUNT_DATA . type === 'git' ) {
58005806 await account1 . server . clearServer ( )
58015807 } else if ( ACCOUNT_DATA . type !== 'fake' ) {
@@ -5824,6 +5830,7 @@ describe('Floccus', function() {
58245830 throw new Error ( 'Google Drive sync left more than one file behind' )
58255831 }
58265832 }
5833+ await browser . bookmarks . removeTree ( account1 . getData ( ) . localRoot )
58275834 await account1 . delete ( )
58285835 await browser . bookmarks . removeTree ( account2 . getData ( ) . localRoot )
58295836 await account2 . delete ( )
@@ -6690,7 +6697,7 @@ describe('Floccus', function() {
66906697 }
66916698 } )
66926699 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 ( ) {
6700+ it ( 'should handle fuzzed changes with deletions from two clients with interrupts' + ( ACCOUNT_DATA . type === 'fake' ? ' (with caching)' : '' ) , interruptBenchmark = async function ( ) {
66946701 const localRoot = account1 . getData ( ) . localRoot
66956702 let bookmarks1 = [ ]
66966703 let folders1 = [ ]
@@ -6927,16 +6934,16 @@ describe('Floccus', function() {
69276934 } )
69286935
69296936 if ( ACCOUNT_DATA . type === 'fake' ) {
6930- it . skip ( 'should handle fuzzed changes with deletions from two clients with interrupts (no caching adapter)' , async function ( ) {
6937+ it ( 'should handle fuzzed changes with deletions from two clients with interrupts (no caching adapter)' , async function ( ) {
69316938 // Wire both accounts to the same fake db
69326939 // We set the cache properties to the same object, because we want to simulate nextcloud-bookmarks
69336940 account1 . server . bookmarksCache = account2 . server . bookmarksCache = new Folder (
69346941 { id : '' , title : 'root' , location : 'Server' }
69356942 )
6936- delete account1 . server . onSyncStart
6937- delete account1 . server . onSyncComplete
6938- delete account2 . server . onSyncStart
6939- delete account2 . server . onSyncComplete
6943+ account1 . server . onSyncStart = null
6944+ account1 . server . onSyncComplete = null
6945+ account2 . server . onSyncStart = null
6946+ account2 . server . onSyncComplete = null
69406947 await interruptBenchmark ( )
69416948 } )
69426949 }
0 commit comments