1
1
import * as domain from 'domain' ;
2
2
import * as SentryNode from '@sentry/node' ;
3
- import type { Event } from '@sentry/types' ;
3
+ import type { Event , Integration } from '@sentry/types' ;
4
4
5
5
import * as Sentry from '../src' ;
6
6
import { wrapCloudEventFunction , wrapEventFunction , wrapHttpFunction } from '../src/gcpfunction' ;
@@ -234,8 +234,6 @@ describe('GCPFunction', () => {
234
234
// integration is included in the defaults and the necessary data is stored in `sdkProcessingMetadata`. The
235
235
// integration's tests cover testing that it uses that data correctly.
236
236
test ( 'wrapHttpFunction request data prereqs' , async ( ) => {
237
- expect . assertions ( 2 ) ;
238
-
239
237
Sentry . GCPFunction . init ( { } ) ;
240
238
241
239
const handler : HttpFunction = ( _req , res ) => {
@@ -245,11 +243,10 @@ describe('GCPFunction', () => {
245
243
246
244
await handleHttp ( wrappedHandler ) ;
247
245
248
- expect ( SentryNode . init ) . toHaveBeenCalledWith (
249
- expect . objectContaining ( {
250
- defaultIntegrations : expect . arrayContaining ( [ expect . any ( SentryNode . Integrations . RequestData ) ] ) ,
251
- } ) ,
252
- ) ;
246
+ const initOptions = ( SentryNode . init as unknown as jest . SpyInstance ) . mock . calls [ 0 ] ;
247
+ const defaultIntegrations = initOptions [ 0 ] . defaultIntegrations . map ( ( i : Integration ) => i . name ) ;
248
+
249
+ expect ( defaultIntegrations ) . toContain ( 'RequestData' ) ;
253
250
254
251
// @ts -expect-error see "Why @ts-expect-error" note
255
252
expect ( SentryNode . fakeScope . setSDKProcessingMetadata ) . toHaveBeenCalledWith ( {
0 commit comments