File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -433,7 +433,12 @@ describe('Tracing Tests', () => {
433433 if ( success ) {
434434 buildSpanMaps ( ) ;
435435 }
436- expect ( spanIdToSpanData . size ) . to . equal (
436+
437+ // Tests are able to perform some Firestore operations inside
438+ // `runFirestoreOperationInRootSpan`, and some Firestore operations outside
439+ // of it. Therefore, if a given test intends to capture some (but not all) spans,
440+ // the in-memory trace will have more spans than `numExpectedSpans`.
441+ expect ( spanIdToSpanData . size ) . to . greaterThanOrEqual (
437442 numExpectedSpans ,
438443 `Could not find expected number of spans (${ numExpectedSpans } )`
439444 ) ;
@@ -812,6 +817,10 @@ describe('Tracing Tests', () => {
812817 } ) ;
813818
814819 it ( 'document reference update()' , async ( ) => {
820+ // Make sure the document exists before updating it.
821+ // Perform the `set` operation outside of the root span.
822+ await firestore . collection ( 'foo' ) . doc ( 'bar' ) . set ( { foo : 'bar' } ) ;
823+
815824 await runFirestoreOperationInRootSpan ( ( ) =>
816825 firestore . collection ( 'foo' ) . doc ( 'bar' ) . update ( 'foo' , 'bar2' )
817826 ) ;
You can’t perform that action at this time.
0 commit comments