@@ -4,13 +4,6 @@ import * as nock from 'nock';
44
55import { AWSServices } from '../src/awsservices' ;
66
7- /**
8- * Why @ts-expect-error some Sentry.X calls
9- *
10- * A hack-ish way to contain everything related to mocks in the same __mocks__ file.
11- * Thanks to this, we don't have to do more magic than necessary. Just add and export desired method and assert on it.
12- */
13-
147describe ( 'AWSServices' , ( ) => {
158 beforeAll ( ( ) => {
169 new AWSServices ( ) . setupOnce ( ) ;
@@ -30,11 +23,10 @@ describe('AWSServices', () => {
3023 nock ( 'https://foo.s3.amazonaws.com' ) . get ( '/bar' ) . reply ( 200 , 'contents' ) ;
3124 const data = await s3 . getObject ( { Bucket : 'foo' , Key : 'bar' } ) . promise ( ) ;
3225 expect ( data . Body ?. toString ( 'utf-8' ) ) . toEqual ( 'contents' ) ;
33- // @ts -expect-error see "Why @ts-expect-error" note
34- expect ( SentryNode . fakeTransaction . startChild ) . toBeCalledWith ( {
26+ expect ( SentryNode . startInactiveSpan ) . toBeCalledWith ( {
3527 op : 'http.client' ,
3628 origin : 'auto.http.serverless' ,
37- description : 'aws.s3.getObject foo' ,
29+ name : 'aws.s3.getObject foo' ,
3830 } ) ;
3931 // @ts -expect-error see "Why @ts-expect-error" note
4032 expect ( SentryNode . fakeSpan . end ) . toBeCalled ( ) ;
@@ -48,11 +40,10 @@ describe('AWSServices', () => {
4840 expect ( data . Body ?. toString ( 'utf-8' ) ) . toEqual ( 'contents' ) ;
4941 done ( ) ;
5042 } ) ;
51- // @ts -expect-error see "Why @ts-expect-error" note
52- expect ( SentryNode . fakeTransaction . startChild ) . toBeCalledWith ( {
43+ expect ( SentryNode . startInactiveSpan ) . toBeCalledWith ( {
5344 op : 'http.client' ,
5445 origin : 'auto.http.serverless' ,
55- description : 'aws.s3.getObject foo' ,
46+ name : 'aws.s3.getObject foo' ,
5647 } ) ;
5748 } ) ;
5849 } ) ;
@@ -64,11 +55,10 @@ describe('AWSServices', () => {
6455 nock ( 'https://lambda.eu-north-1.amazonaws.com' ) . post ( '/2015-03-31/functions/foo/invocations' ) . reply ( 201 , 'reply' ) ;
6556 const data = await lambda . invoke ( { FunctionName : 'foo' } ) . promise ( ) ;
6657 expect ( data . Payload ?. toString ( 'utf-8' ) ) . toEqual ( 'reply' ) ;
67- // @ts -expect-error see "Why @ts-expect-error" note
68- expect ( SentryNode . fakeTransaction . startChild ) . toBeCalledWith ( {
58+ expect ( SentryNode . startInactiveSpan ) . toBeCalledWith ( {
6959 op : 'http.client' ,
7060 origin : 'auto.http.serverless' ,
71- description : 'aws.lambda.invoke foo' ,
61+ name : 'aws.lambda.invoke foo' ,
7262 } ) ;
7363 } ) ;
7464 } ) ;
0 commit comments