@@ -86,6 +86,21 @@ describe('QueryExecutor', () => {
8686 expect ( spyOnExecuteRead ) . toHaveBeenCalled ( )
8787 } )
8888
89+ it ( 'should configure the session with pipeline begin' , async ( ) => {
90+ const { queryExecutor, sessionsCreated } = createExecutor ( )
91+
92+ await queryExecutor . execute ( baseConfig , 'query' )
93+
94+ expect ( sessionsCreated . length ) . toBe ( 1 )
95+ const [ { spyOnSetTxExecutorToPipelineBegin, spyOnExecuteRead } ] = sessionsCreated
96+
97+ expect ( spyOnSetTxExecutorToPipelineBegin ) . toHaveBeenCalledTimes ( 1 )
98+ expect ( spyOnSetTxExecutorToPipelineBegin ) . toHaveBeenCalledWith ( true )
99+ expect ( spyOnExecuteRead . mock . invocationCallOrder [ 0 ] ) . toBeGreaterThan (
100+ spyOnSetTxExecutorToPipelineBegin . mock . invocationCallOrder [ 0 ]
101+ )
102+ } )
103+
89104 it ( 'should call not call executeWrite' , async ( ) => {
90105 const { queryExecutor, sessionsCreated } = createExecutor ( )
91106
@@ -213,6 +228,21 @@ describe('QueryExecutor', () => {
213228 expect ( spyOnExecuteWrite ) . toHaveBeenCalled ( )
214229 } )
215230
231+ it ( 'should configure the session with pipeline begin' , async ( ) => {
232+ const { queryExecutor, sessionsCreated } = createExecutor ( )
233+
234+ await queryExecutor . execute ( baseConfig , 'query' )
235+
236+ expect ( sessionsCreated . length ) . toBe ( 1 )
237+ const [ { spyOnSetTxExecutorToPipelineBegin, spyOnExecuteWrite } ] = sessionsCreated
238+
239+ expect ( spyOnSetTxExecutorToPipelineBegin ) . toHaveBeenCalledTimes ( 1 )
240+ expect ( spyOnSetTxExecutorToPipelineBegin ) . toHaveBeenCalledWith ( true )
241+ expect ( spyOnExecuteWrite . mock . invocationCallOrder [ 0 ] ) . toBeGreaterThan (
242+ spyOnSetTxExecutorToPipelineBegin . mock . invocationCallOrder [ 0 ]
243+ )
244+ } )
245+
216246 it ( 'should call not call executeRead' , async ( ) => {
217247 const { queryExecutor, sessionsCreated } = createExecutor ( )
218248
@@ -316,7 +346,7 @@ describe('QueryExecutor', () => {
316346 spyOnExecuteRead : jest . SpyInstance < any >
317347 spyOnExecuteWrite : jest . SpyInstance < any >
318348 spyOnClose : jest . SpyInstance < Promise < void > >
319-
349+ spyOnSetTxExecutorToPipelineBegin : jest . SpyInstance < void >
320350 } >
321351 createSession : jest . Mock < Session , [ args : any ] >
322352 } {
@@ -329,15 +359,17 @@ describe('QueryExecutor', () => {
329359 spyOnExecuteRead : jest . SpyInstance < any >
330360 spyOnExecuteWrite : jest . SpyInstance < any >
331361 spyOnClose : jest . SpyInstance < Promise < void > >
332-
362+ spyOnSetTxExecutorToPipelineBegin : jest . SpyInstance < void >
333363 } > = [ ]
334364 const createSession = jest . fn ( ( args ) => {
335365 const session = new Session ( args )
336366 const sessionCreated = {
337367 session,
338368 spyOnExecuteRead : jest . spyOn ( session , 'executeRead' ) ,
339369 spyOnExecuteWrite : jest . spyOn ( session , 'executeWrite' ) ,
340- spyOnClose : jest . spyOn ( session , 'close' )
370+ spyOnClose : jest . spyOn ( session , 'close' ) ,
371+ // @ts -expect-error
372+ spyOnSetTxExecutorToPipelineBegin : jest . spyOn ( session , '_setTxExecutorToPipelineBegin' )
341373 }
342374 sessionsCreated . push ( sessionCreated )
343375 _mockSessionExecuteRead ( sessionCreated . spyOnExecuteRead )
0 commit comments