@@ -90,22 +90,22 @@ describe('Pseudo EXIT events', () => {
9090
9191 const log1 = parse ( logData ) ;
9292 expect ( log1 . children . length ) . toEqual ( 4 ) ;
93- expect ( log1 . duration ) . toEqual ( 3 ) ;
93+ expect ( log1 . duration ) . toEqual ( { self : 0 , total : 3 } ) ;
9494
9595 const approval1 = log1 . children [ 0 ] as Method ;
96- expect ( approval1 . duration ) . toEqual ( 1 ) ;
96+ expect ( approval1 . duration ) . toEqual ( { self : 1 , total : 1 } ) ;
9797 expect ( approval1 . type ) . toEqual ( 'WF_APPROVAL_SUBMIT' ) ;
9898
9999 const processFound1 = log1 . children [ 1 ] as Method ;
100- expect ( processFound1 . duration ) . toEqual ( 1 ) ;
100+ expect ( processFound1 . duration ) . toEqual ( { self : 1 , total : 1 } ) ;
101101 expect ( processFound1 . type ) . toEqual ( 'WF_PROCESS_FOUND' ) ;
102102
103103 const approval2 = log1 . children [ 2 ] as Method ;
104- expect ( approval2 . duration ) . toEqual ( 1 ) ;
104+ expect ( approval2 . duration ) . toEqual ( { self : 1 , total : 1 } ) ;
105105 expect ( approval2 . type ) . toEqual ( 'WF_APPROVAL_SUBMIT' ) ;
106106
107107 const processFound2 = log1 . children [ 3 ] as Method ;
108- expect ( processFound2 . duration ) . toEqual ( 0 ) ; // no lines after the last WF_PROCESS_FOUND to use as an exit
108+ expect ( processFound2 . duration ) . toEqual ( { self : 0 , total : 0 } ) ; // no lines after the last WF_PROCESS_FOUND to use as an exit
109109 expect ( processFound2 . type ) . toEqual ( 'WF_PROCESS_FOUND' ) ;
110110 } ) ;
111111
@@ -121,7 +121,7 @@ describe('Pseudo EXIT events', () => {
121121
122122 const log1 = parse ( logData ) ;
123123 expect ( log1 . children . length ) . toEqual ( 1 ) ;
124- expect ( log1 . duration ) . toEqual ( 6 ) ;
124+ expect ( log1 . duration ) . toEqual ( { self : 0 , total : 6 } ) ;
125125
126126 const children = ( log1 . children [ 0 ] as Method ) . children ;
127127 expect ( children . length ) . toEqual ( 4 ) ;
@@ -153,7 +153,7 @@ describe('Pseudo EXIT events', () => {
153153
154154 const log1 = parse ( logData ) ;
155155 expect ( log1 . children . length ) . toEqual ( 1 ) ;
156- expect ( log1 . duration ) . toEqual ( 4 ) ;
156+ expect ( log1 . duration ) . toEqual ( { self : 0 , total : 4 } ) ;
157157
158158 const children = ( log1 . children [ 0 ] as Method ) . children ;
159159 expect ( children . length ) . toEqual ( 3 ) ;
@@ -426,8 +426,8 @@ describe('parseLog tests', () => {
426426 const soqlLine = execEvent . children [ 0 ] as SOQLExecuteBeginLine ;
427427 expect ( soqlLine . type ) . toEqual ( 'SOQL_EXECUTE_BEGIN' ) ;
428428 expect ( soqlLine . aggregations ) . toEqual ( 2 ) ;
429- expect ( soqlLine . selfRowCount ) . toEqual ( 50 ) ;
430- expect ( soqlLine . totalRowCount ) . toEqual ( 50 ) ;
429+ expect ( soqlLine . rowCount . self ) . toEqual ( 50 ) ;
430+ expect ( soqlLine . rowCount . total ) . toEqual ( 50 ) ;
431431
432432 const soqlExplain = soqlLine . children [ 0 ] as SOQLExecuteExplainLine ;
433433 expect ( soqlExplain . type ) . toEqual ( 'SOQL_EXECUTE_EXPLAIN' ) ;
@@ -474,7 +474,7 @@ describe('getRootMethod tests', () => {
474474 expect ( interViewsBegin . children . length ) . toBe ( 1 ) ;
475475 const interViewBegin = interViewsBegin . children [ 0 ] ;
476476 expect ( interViewBegin ?. type ) . toBe ( 'FLOW_START_INTERVIEW_BEGIN' ) ;
477- expect ( interViewBegin ?. duration ) . toBe ( 6332706 ) ;
477+ expect ( interViewBegin ?. duration ) . toEqual ( { self : 6332706 , total : 6332706 } ) ;
478478 } ) ;
479479
480480 it ( 'FlowStartInterviewsBeginLine should be a flow ' , async ( ) => {
@@ -509,7 +509,7 @@ describe('getRootMethod tests', () => {
509509 expect ( interViewsBegin . children . length ) . toBe ( 1 ) ;
510510 const interViewBegin = interViewsBegin . children [ 0 ] ;
511511 expect ( interViewBegin ?. type ) . toBe ( 'FLOW_START_INTERVIEW_BEGIN' ) ;
512- expect ( interViewBegin ?. duration ) . toBe ( 6332706 ) ;
512+ expect ( interViewBegin ?. duration ) . toEqual ( { self : 6332706 , total : 6332706 } ) ;
513513 } ) ;
514514
515515 it ( 'FlowStartInterviewsBeginLine should be a flow called from a process builder' , async ( ) => {
@@ -554,12 +554,12 @@ describe('getRootMethod tests', () => {
554554 expect ( interViewsBegin . type ) . toBe ( 'FLOW_START_INTERVIEWS_BEGIN' ) ;
555555 expect ( interViewsBegin . text ) . toBe ( 'FLOW_START_INTERVIEWS : Example Flow' ) ;
556556 expect ( interViewsBegin . suffix ) . toBe ( ' (Flow)' ) ;
557- expect ( interViewsBegin . duration ) . toBe ( 3 ) ;
557+ expect ( interViewsBegin . duration ) . toEqual ( { self : 2 , total : 3 } ) ;
558558
559559 expect ( interViewsBegin . children . length ) . toBe ( 1 ) ;
560560 const interViewBegin = interViewsBegin . children [ 0 ] ;
561561 expect ( interViewBegin ?. type ) . toBe ( 'FLOW_START_INTERVIEW_BEGIN' ) ;
562- expect ( interViewBegin ?. duration ) . toBe ( 1 ) ;
562+ expect ( interViewBegin ?. duration ) . toEqual ( { self : 1 , total : 1 } ) ;
563563 } ) ;
564564
565565 it ( 'Root exitStamp should match last line pair with a duration' , async ( ) => {
@@ -691,21 +691,20 @@ describe('Recalculate durations tests', () => {
691691 node . exitStamp = 3 ;
692692
693693 node . recalculateDurations ( ) ;
694- expect ( node . duration ) . toBe ( 2 ) ;
695- expect ( node . selfTime ) . toBe ( 2 ) ;
694+ expect ( node . duration ) . toEqual ( { self : 2 , total : 2 } ) ;
696695 } ) ;
696+
697697 it ( 'Children are subtracted from net duration' , ( ) => {
698698 const node = new Method ( [ '14:32:07.563 (0)' , 'DUMMY' ] , [ ] , 'Method' , '' ) ,
699699 child1 = new Method ( [ '14:32:07.563 (10)' , 'DUMMY' ] , [ ] , 'Method' , '' ) ,
700700 child2 = new Method ( [ '14:32:07.563 (70)' , 'DUMMY' ] , [ ] , 'Method' , '' ) ;
701701 node . exitStamp = 100 ;
702- child1 . duration = 50 ;
703- child2 . duration = 25 ;
702+ child1 . duration . total = 50 ;
703+ child2 . duration . total = 25 ;
704704 node . addChild ( child1 ) ;
705705 node . addChild ( child2 ) ;
706706 node . recalculateDurations ( ) ;
707- expect ( node . duration ) . toBe ( 100 ) ;
708- expect ( node . selfTime ) . toBe ( 25 ) ;
707+ expect ( node . duration ) . toEqual ( { self : 25 , total : 100 } ) ;
709708 } ) ;
710709} ) ;
711710
0 commit comments