@@ -19,23 +19,19 @@ import { LambdaFunctionNode } from '../../../../../lambda/explorer/lambdaFunctio
1919import { RestApiNode } from '../../../../../awsService/apigateway/explorer/apiNodes'
2020import { S3BucketNode } from '../../../../../awsService/s3/explorer/s3BucketNode'
2121import * as LambdaNodeModule from '../../../../../lambda/explorer/lambdaNodes'
22- import { getLogger } from '../../../../../shared/logger/logger'
2322import { getIcon } from '../../../../../shared/icons'
2423import _ from 'lodash'
2524import { isTreeNode } from '../../../../../shared/treeview/resourceTreeDataProvider'
2625import { Any } from '../../../../../shared/utilities/typeConstructors'
2726import { IamConnection , ProfileMetadata } from '../../../../../auth/connection'
2827import * as AuthUtils from '../../../../../auth/utils'
28+ import { assertLogsContain } from '../../../../../test/globalSetup.test'
2929
3030describe ( 'DeployedResourceNode' , ( ) => {
3131 const expectedStackName = 'myStack'
3232 const expectedRegionCode = 'us-west-2'
33- let loggerWarnStub : sinon . SinonStub < [ message : string | Error , ...meta : any [ ] ] , number >
3433
35- beforeEach ( ( ) => {
36- // Create a stub for the entire logger module
37- loggerWarnStub = sinon . stub ( getLogger ( ) , 'warn' )
38- } )
34+ beforeEach ( ( ) => { } )
3935
4036 afterEach ( ( ) => {
4137 // Restore the original function after each test
@@ -87,8 +83,7 @@ describe('DeployedResourceNode', () => {
8783 assert . strictEqual ( deployedLambdaNode . id , '' )
8884 assert . strictEqual ( deployedLambdaNode . contextValue , '' )
8985 assert . deepStrictEqual ( deployedLambdaNode . resource , emptyArnDeployedResource )
90- assert ( loggerWarnStub . calledOnce )
91- assert ( loggerWarnStub . calledWith ( 'Cannot create DeployedResourceNode, the ARN does not exist.' ) )
86+ assertLogsContain ( 'Cannot create DeployedResourceNode, the ARN does not exist.' , false , 'warn' )
9287 } )
9388 } )
9489 } )
@@ -121,17 +116,13 @@ describe('DeployedResourceNode', () => {
121116describe ( 'generateDeployedNode' , ( ) => {
122117 const expectedStackName = 'myStack'
123118 const expectedRegionCode = 'us-west-2'
124- let loggerErrorStub : sinon . SinonStub < [ message : string | Error , ...meta : any [ ] ] , number >
125- let loggerInfoStub : sinon . SinonStub < [ message : string | Error , ...meta : any [ ] ] , number >
126119
127120 let sandbox : sinon . SinonSandbox
128121
129122 beforeEach ( ( ) => {
130123 // Initiate stub sanbox
131124 sandbox = sinon . createSandbox ( )
132125 // Create a stub for the entire logger module
133- loggerErrorStub = sandbox . stub ( getLogger ( ) , 'error' )
134- loggerInfoStub = sandbox . stub ( getLogger ( ) , 'info' )
135126 } )
136127 afterEach ( async ( ) => {
137128 sandbox . restore ( )
@@ -223,8 +214,7 @@ describe('generateDeployedNode', () => {
223214 lambdaDeployedNodeInput . resourceTreeEntity
224215 )
225216
226- assert ( loggerErrorStub . calledOnceWith ( 'Error getting Lambda configuration %O' ) )
227- assert ( loggerErrorStub . neverCalledWith ( 'Error getting Lambda V3 configuration %O' ) )
217+ assertLogsContain ( 'Error getting Lambda configuration %O' , true , 'error' )
228218 assert ( deployedResourceNodes . length === 1 )
229219
230220 // Check placeholder propertries
@@ -375,10 +365,7 @@ describe('generateDeployedNode', () => {
375365 unsupportTypeInput . resourceTreeEntity
376366 )
377367
378- assert ( loggerInfoStub . calledOnceWith ( 'Details are missing or are incomplete for: %O' ) )
379-
380- // Check deployedResourceNodes array propertries
381- assert ( loggerErrorStub . neverCalledWith ( 'Error getting Lambda V3 configuration %O' ) )
368+ assertLogsContain ( 'Details are missing or are incomplete for:' , false , 'info' )
382369
383370 // Check deployedResourceNodes array propertries
384371 assert ( deployedResourceNodes . length === 1 )
0 commit comments