@@ -7,13 +7,11 @@ import { getCurrentHub, Hub, Scope } from '../src';
77
88const clientFn : any = jest . fn ( ) ;
99
10- const MOCK_EVENT_ID = '7bab5137428b4de29891fb8bd34a31cb' ;
11-
1210function makeClient ( ) {
1311 return {
1412 getOptions : jest . fn ( ) ,
1513 captureEvent : jest . fn ( ) ,
16- captureException : jest . fn ( ) . mockReturnValue ( MOCK_EVENT_ID ) ,
14+ captureException : jest . fn ( ) ,
1715 close : jest . fn ( ) ,
1816 flush : jest . fn ( ) ,
1917 getDsn : jest . fn ( ) ,
@@ -226,12 +224,14 @@ describe('Hub', () => {
226224 expect ( args [ 0 ] ) . toBe ( 'a' ) ;
227225 } ) ;
228226
229- test ( 'should get event_id from client ' , ( ) => {
227+ test ( 'should set event_id in hint ' , ( ) => {
230228 const testClient = makeClient ( ) ;
231229 const hub = new Hub ( testClient ) ;
232230
233- const id = hub . captureException ( 'a' ) ;
234- expect ( id ) . toBeDefined ( ) ;
231+ hub . captureException ( 'a' ) ;
232+ const args = getPassedArgs ( testClient . captureException ) ;
233+
234+ expect ( args [ 1 ] . event_id ) . toBeTruthy ( ) ;
235235 } ) ;
236236
237237 test ( 'should keep event_id from hint' , ( ) => {
@@ -270,12 +270,14 @@ describe('Hub', () => {
270270 expect ( args [ 0 ] ) . toBe ( 'a' ) ;
271271 } ) ;
272272
273- test ( 'should get event_id from client ' , ( ) => {
273+ test ( 'should set event_id in hint ' , ( ) => {
274274 const testClient = makeClient ( ) ;
275275 const hub = new Hub ( testClient ) ;
276276
277- const id = hub . captureMessage ( 'a' ) ;
278- expect ( id ) . toBeDefined ( ) ;
277+ hub . captureMessage ( 'a' ) ;
278+ const args = getPassedArgs ( testClient . captureMessage ) ;
279+
280+ expect ( args [ 2 ] . event_id ) . toBeTruthy ( ) ;
279281 } ) ;
280282
281283 test ( 'should keep event_id from hint' , ( ) => {
@@ -316,15 +318,17 @@ describe('Hub', () => {
316318 expect ( args [ 0 ] ) . toBe ( event ) ;
317319 } ) ;
318320
319- test ( 'should get event_id from client ' , ( ) => {
321+ test ( 'should set event_id in hint ' , ( ) => {
320322 const event : Event = {
321323 extra : { b : 3 } ,
322324 } ;
323325 const testClient = makeClient ( ) ;
324326 const hub = new Hub ( testClient ) ;
325327
326- const id = hub . captureEvent ( event ) ;
327- expect ( id ) . toBeDefined ( ) ;
328+ hub . captureEvent ( event ) ;
329+ const args = getPassedArgs ( testClient . captureEvent ) ;
330+
331+ expect ( args [ 1 ] . event_id ) . toBeTruthy ( ) ;
328332 } ) ;
329333
330334 test ( 'should keep event_id from hint' , ( ) => {
@@ -348,8 +352,10 @@ describe('Hub', () => {
348352 const testClient = makeClient ( ) ;
349353 const hub = new Hub ( testClient ) ;
350354
351- const id = hub . captureEvent ( event ) ;
352- expect ( id ) . toEqual ( hub . lastEventId ( ) ) ;
355+ hub . captureEvent ( event ) ;
356+ const args = getPassedArgs ( testClient . captureEvent ) ;
357+
358+ expect ( args [ 1 ] . event_id ) . toEqual ( hub . lastEventId ( ) ) ;
353359 } ) ;
354360
355361 test ( 'transactions do not set lastEventId' , ( ) => {
@@ -360,8 +366,10 @@ describe('Hub', () => {
360366 const testClient = makeClient ( ) ;
361367 const hub = new Hub ( testClient ) ;
362368
363- const id = hub . captureEvent ( event ) ;
364- expect ( id ) . not . toEqual ( hub . lastEventId ( ) ) ;
369+ hub . captureEvent ( event ) ;
370+ const args = getPassedArgs ( testClient . captureEvent ) ;
371+
372+ expect ( args [ 1 ] . event_id ) . not . toEqual ( hub . lastEventId ( ) ) ;
365373 } ) ;
366374 } ) ;
367375
0 commit comments