@@ -295,18 +295,16 @@ export class SyncPointTestParser {
295
295
296
296
// foreach in actual, stack up to enforce ordering, find in expected
297
297
const actualMap = { } ;
298
- let actualEvent ;
299
298
for ( let x = 0 ; x < actualSlice . length ; ++ x ) {
300
- actualEvent = actualSlice [ x ] ;
301
- actualEvent . eventRegistration . getEventRunner ( actualEvent ) ( ) ;
299
+ let actualEvent = actualSlice [ x ] ;
302
300
const spec = currentSpec ;
303
- const listenId =
301
+ let listenId =
304
302
this . getTestPath ( optBasePath , spec . path ) . toString ( ) +
305
303
'|' +
306
304
spec . ref . _queryIdentifier ;
307
305
if ( listenId in actualMap ) {
308
306
// stack this event up, and make sure it obeys ordering constraints
309
- const eventStack = actualMap [ listenId ] ;
307
+ let eventStack = actualMap [ listenId ] ;
310
308
assertEventsOrdered (
311
309
eventStack [ eventStack . length - 1 ] . eventType ,
312
310
actualEvent . eventType
@@ -316,39 +314,39 @@ export class SyncPointTestParser {
316
314
// this is the first event for this listen, just initialize it
317
315
actualMap [ listenId ] = [ actualEvent ] ;
318
316
}
319
- }
320
- // Ordering has been enforced, make sure we can find this in the expected events
321
- const found = removeIf ( expectedSlice , expectedEvent => {
322
- checkValidProperties ( expectedEvent , [
323
- 'type ',
324
- 'path ',
325
- 'name ',
326
- 'prevName' ,
327
- 'data'
328
- ] ) ;
329
- if ( expectedEvent . type === actualEvent . eventType ) {
330
- if ( expectedEvent . type !== 'value' ) {
331
- if ( expectedEvent . name !== actualEvent . snapshot . key ) {
332
- return false ;
333
- }
334
- if (
335
- expectedEvent . type !== 'child_removed' &&
336
- expectedEvent . prevName !== actualEvent . prevName
337
- ) {
338
- return false ;
317
+ // Ordering has been enforced, make sure we can find this in the expected events
318
+ let found = removeIf ( expectedSlice , expectedEvent => {
319
+ checkValidProperties ( expectedEvent , [
320
+ 'type' ,
321
+ 'path ',
322
+ 'name ',
323
+ 'prevName ',
324
+ 'data'
325
+ ] ) ;
326
+ if ( expectedEvent . type === actualEvent . eventType ) {
327
+ if ( expectedEvent . type !== 'value' ) {
328
+ if ( expectedEvent . name !== actualEvent . snapshot . key ) {
329
+ return false ;
330
+ }
331
+ if (
332
+ expectedEvent . type !== 'child_removed' &&
333
+ expectedEvent . prevName !== actualEvent . prevName
334
+ ) {
335
+ return false ;
336
+ }
339
337
}
338
+ // make sure the snapshots match
339
+ let snapHash = actualEvent . snapshot . _node . hash ( ) ;
340
+ let expectedHash = nodeFromJSON ( expectedEvent . data ) . hash ( ) ;
341
+ return snapHash === expectedHash ;
342
+ } else {
343
+ return false ;
340
344
}
341
- // make sure the snapshots match
342
- const snapHash = actualEvent . snapshot . _node . hash ( ) ;
343
- const expectedHash = nodeFromJSON ( expectedEvent . data ) . hash ( ) ;
344
- return snapHash === expectedHash ;
345
- } else {
346
- return false ;
345
+ } ) ;
346
+ if ( ! found ) {
347
+ console . log ( actualEvent ) ;
348
+ throw new Error ( 'Could not find matching expected event' ) ;
347
349
}
348
- } ) ;
349
- if ( ! found ) {
350
- // console.log(actualEvent);
351
- throw new Error ( 'Could not find matching expected event' ) ;
352
350
}
353
351
currentExpected = currentExpected . slice ( i ) ;
354
352
currentActual = currentActual . slice ( i ) ;
@@ -484,6 +482,8 @@ export class SyncPointTestParser {
484
482
} else {
485
483
events = syncTreeApplyServerOverwrite ( this . syncTree_ , path , update ) ;
486
484
}
485
+ console . log ( 'spec events' , spec . events ) ;
486
+ console . log ( 'events' , events ) ;
487
487
eventSetMatch ( spec . events , events ) ;
488
488
} else if ( spec . type === 'serverMerge' ) {
489
489
checkValidProperties ( spec , [ 'type' , 'path' , 'data' , 'tag' , 'events' ] ) ;
0 commit comments