@@ -692,9 +692,7 @@ describe('Class: Tracer', () => {
692
692
. mockImplementation ( ( ) => ( { } ) ) ;
693
693
694
694
// Act
695
- const newSubsegment : Segment | Subsegment | undefined = new Subsegment (
696
- '## foo.bar'
697
- ) ;
695
+ const newSubsegment = new Subsegment ( '## foo.bar' ) ;
698
696
tracer . setSegment ( newSubsegment ) ;
699
697
700
698
// Assess
@@ -961,9 +959,7 @@ describe('Class: Tracer', () => {
961
959
it ( 'awaits async methods correctly' , async ( ) => {
962
960
// Prepare
963
961
const tracer : Tracer = new Tracer ( ) ;
964
- const newSubsegment : Segment | Subsegment | undefined = new Subsegment (
965
- '### dummyMethod'
966
- ) ;
962
+ const newSubsegment = new Subsegment ( '### dummyMethod' ) ;
967
963
968
964
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
969
965
( ) => newSubsegment
@@ -975,7 +971,7 @@ describe('Class: Tracer', () => {
975
971
createCaptureAsyncFuncMock ( tracer . provider , newSubsegment ) ;
976
972
977
973
class Lambda implements LambdaInterface {
978
- private memberVariable : string ;
974
+ private readonly memberVariable : string ;
979
975
980
976
public constructor ( memberVariable : string ) {
981
977
this . memberVariable = memberVariable ;
@@ -1021,8 +1017,7 @@ describe('Class: Tracer', () => {
1021
1017
it ( 'catches the error and logs a warning when a segment fails to close/serialize' , async ( ) => {
1022
1018
// Prepare
1023
1019
const tracer : Tracer = new Tracer ( ) ;
1024
- const handlerSubsegment : Segment | Subsegment | undefined =
1025
- new Subsegment ( '### dummyMethod' ) ;
1020
+ const handlerSubsegment = new Subsegment ( '### dummyMethod' ) ;
1026
1021
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
1027
1022
( ) => handlerSubsegment
1028
1023
) ;
@@ -1192,9 +1187,7 @@ describe('Class: Tracer', () => {
1192
1187
it ( 'captures the exception correctly' , async ( ) => {
1193
1188
// Prepare
1194
1189
const tracer : Tracer = new Tracer ( ) ;
1195
- const newSubsegment : Segment | Subsegment | undefined = new Subsegment (
1196
- '### dummyMethod'
1197
- ) ;
1190
+ const newSubsegment = new Subsegment ( '### dummyMethod' ) ;
1198
1191
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
1199
1192
( ) => newSubsegment
1200
1193
) ;
@@ -1237,9 +1230,7 @@ describe('Class: Tracer', () => {
1237
1230
it ( 'preserves the this scope correctly when used as decorator' , async ( ) => {
1238
1231
// Prepare
1239
1232
const tracer : Tracer = new Tracer ( ) ;
1240
- const newSubsegment : Segment | Subsegment | undefined = new Subsegment (
1241
- '### dummyMethod'
1242
- ) ;
1233
+ const newSubsegment = new Subsegment ( '### dummyMethod' ) ;
1243
1234
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
1244
1235
( ) => newSubsegment
1245
1236
) ;
@@ -1274,9 +1265,7 @@ describe('Class: Tracer', () => {
1274
1265
it ( 'awaits the async method correctly when used as decorator' , async ( ) => {
1275
1266
// Prepare
1276
1267
const tracer : Tracer = new Tracer ( ) ;
1277
- const newSubsegment : Segment | Subsegment | undefined = new Subsegment (
1278
- '### dummyMethod'
1279
- ) ;
1268
+ const newSubsegment = new Subsegment ( '### dummyMethod' ) ;
1280
1269
1281
1270
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
1282
1271
( ) => newSubsegment
@@ -1375,9 +1364,7 @@ describe('Class: Tracer', () => {
1375
1364
it ( 'sets the correct name for the subsegment when used as decorator and with a custom subSegmentName' , async ( ) => {
1376
1365
// Prepare
1377
1366
const tracer : Tracer = new Tracer ( ) ;
1378
- const newSubsegment : Segment | Subsegment | undefined = new Subsegment (
1379
- '### dummyMethod'
1380
- ) ;
1367
+ const newSubsegment = new Subsegment ( '### dummyMethod' ) ;
1381
1368
vi . spyOn ( newSubsegment , 'flush' ) . mockImplementation ( ( ) => null ) ;
1382
1369
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
1383
1370
( ) => newSubsegment
@@ -1412,8 +1399,7 @@ describe('Class: Tracer', () => {
1412
1399
it ( 'catches the error and logs a warning when a segment fails to close/serialize' , async ( ) => {
1413
1400
// Prepare
1414
1401
const tracer : Tracer = new Tracer ( ) ;
1415
- const handlerSubsegment : Segment | Subsegment | undefined =
1416
- new Subsegment ( '### dummyMethod' ) ;
1402
+ const handlerSubsegment = new Subsegment ( '### dummyMethod' ) ;
1417
1403
vi . spyOn ( tracer . provider , 'getSegment' ) . mockImplementation (
1418
1404
( ) => handlerSubsegment
1419
1405
) ;
0 commit comments