File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/unbound-method */
2
2
import { createTransport , Scope } from '@sentry/core' ;
3
- import { MockIntegration } from '@sentry/core/test/lib/sdk.test' ;
4
3
import type { Client , Integration } from '@sentry/types' ;
5
4
import { resolvedSyncPromise } from '@sentry/utils' ;
6
5
@@ -18,6 +17,14 @@ function getDefaultBrowserOptions(options: Partial<BrowserOptions> = {}): Browse
18
17
} ;
19
18
}
20
19
20
+ export class MockIntegration implements Integration {
21
+ public name : string ;
22
+ public setupOnce : ( ) => void = jest . fn ( ) ;
23
+ public constructor ( name : string ) {
24
+ this . name = name ;
25
+ }
26
+ }
27
+
21
28
jest . mock ( '@sentry/core' , ( ) => {
22
29
const original = jest . requireActual ( '@sentry/core' ) ;
23
30
return {
Original file line number Diff line number Diff line change @@ -196,17 +196,14 @@ export function startTransaction(
196
196
* to create a monitor automatically when sending a check in.
197
197
*/
198
198
export function captureCheckIn ( checkIn : CheckIn , upsertMonitorConfig ?: MonitorConfig ) : string {
199
- const capturedCheckIn =
200
- checkIn . status !== 'in_progress' && checkIn . checkInId ? checkIn : { ...checkIn , checkInId : uuid4 ( ) } ;
201
-
202
199
const client = getCurrentHub ( ) . getClient ( ) ;
203
200
if ( ! client ) {
204
201
__DEBUG_BUILD__ && logger . warn ( 'Cannot capture check-in. No client defined.' ) ;
205
202
} else if ( ! client . captureCheckIn ) {
206
203
__DEBUG_BUILD__ && logger . warn ( 'Cannot capture check-in. Client does not support sending check-ins.' ) ;
207
204
} else {
208
- client . captureCheckIn ( capturedCheckIn , upsertMonitorConfig ) ;
205
+ return client . captureCheckIn ( checkIn , upsertMonitorConfig ) ;
209
206
}
210
207
211
- return capturedCheckIn . checkInId ;
208
+ return uuid4 ( ) ;
212
209
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ describe('captureCheckIn', () => {
47
47
} as unknown as Client ;
48
48
} ) ;
49
49
50
- expect ( captureCheckIn ( { monitorSlug : 'gogogo' , status : 'in_progress' } ) ) . toStrictEqual ( expect . any ( String ) ) ;
50
+ expect ( captureCheckIn ( { monitorSlug : 'gogogo' , status : 'in_progress' } ) ) . toStrictEqual ( 'some-id-wasd-1234' ) ;
51
51
} ) ;
52
52
53
53
it ( 'returns an id when client is undefined' , ( ) => {
You can’t perform that action at this time.
0 commit comments