@@ -278,8 +278,7 @@ describe('api', () => {
278278 expect ( mockBatchAdd ) . not . toHaveBeenCalled ( )
279279 } )
280280
281- // TODO: Validate that this test is actually correct
282- it ( 'should capture entry snapshot only for ENTRY evaluation with no condition' , ( ) => {
281+ it ( 'should capture both entry and return snapshots for ENTRY evaluation' , ( ) => {
283282 const probe : Probe = {
284283 id : 'test-probe' ,
285284 version : 0 ,
@@ -319,6 +318,46 @@ describe('api', () => {
319318 } )
320319 } )
321320
321+ it ( 'should capture both entry and return snapshots for EXIT evaluation with no condition' , ( ) => {
322+ const probe : Probe = {
323+ id : 'test-probe' ,
324+ version : 0 ,
325+ type : 'LOG_PROBE' ,
326+ where : { typeName : 'TestClass' , methodName : 'exitSnapshotNoCondition' } ,
327+ template : 'Test' ,
328+ captureSnapshot : true ,
329+ capture : { maxReferenceDepth : 1 } ,
330+ sampling : { } ,
331+ evaluateAt : 'EXIT' ,
332+ }
333+ addProbe ( probe )
334+
335+ const probes = getProbes ( 'TestClass;exitSnapshotNoCondition' ) !
336+ onEntry ( probes , { name : 'obj' } , { arg : 'value' } )
337+ onReturn ( probes , 'result' , { name : 'obj' } , { arg : 'value' } , { local : 'data' } )
338+
339+ const payload = mockBatchAdd . calls . mostRecent ( ) . args [ 0 ]
340+ const snapshot = payload . debugger . snapshot
341+ expect ( snapshot . captures ) . toEqual ( {
342+ entry : {
343+ arguments : {
344+ arg : { type : 'string' , value : 'value' } ,
345+ this : { type : 'Object' , fields : { name : { type : 'string' , value : 'obj' } } } ,
346+ } ,
347+ } ,
348+ return : {
349+ arguments : {
350+ arg : { type : 'string' , value : 'value' } ,
351+ this : { type : 'Object' , fields : { name : { type : 'string' , value : 'obj' } } } ,
352+ } ,
353+ locals : {
354+ local : { type : 'string' , value : 'data' } ,
355+ '@return' : { type : 'string' , value : 'result' } ,
356+ } ,
357+ } ,
358+ } )
359+ } )
360+
322361 it ( 'should only capture return snapshot for EXIT evaluation with condition' , ( ) => {
323362 const probe : Probe = {
324363 id : 'test-probe' ,
0 commit comments