Skip to content

Commit

Permalink
fix test cases that inspect the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Nov 6, 2024
1 parent f0cb44b commit d5151c5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function generateDeployedNode(
.Configuration as Lambda.FunctionConfiguration
newDeployedResource = new LambdaFunctionNode(lambdaNode, regionCode, configuration)
} catch (error: any) {
getLogger().error('Error getting Lambda configuration')
getLogger().error('Error getting Lambda configuration %O', error)
throw ToolkitError.chain(error, 'Error getting Lambda configuration', {
code: 'lambdaClientError',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('samProject', () => {
// simulate error when no samconfig.toml file in directory
const result = await getStackName(projectRoot)
assert.deepStrictEqual(result, {})
assertLogsContain('No stack name or region information available in samconfig.toml', true, 'info')
assertLogsContain('No stack name or region information available in samconfig.toml: %O', true, 'info')
})

it('returns empty object give error parsing samconfig file', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('RemoteInvokeWebview', () => {
new Error('Failed to read selected file')
)
assert.strictEqual(loggerErrorStub.calledOnce, true)
assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %O')
assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %s %O')
assert.strictEqual(loggerErrorStub.firstCall.args[1], fileUri.fsPath)
assert(loggerErrorStub.firstCall.args[2] instanceof Error)
} finally {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/test/lambda/vue/samInvokeBackend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ describe('SamInvokeWebview', () => {
new Error('Failed to read selected file')
)
assert.strictEqual(loggerErrorStub.calledOnce, true)
assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %O')
assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %s %O')
assert.strictEqual(loggerErrorStub.firstCall.args[1], fileUri.fsPath)
assert(loggerErrorStub.firstCall.args[2] instanceof Error)
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ describe('generateDeployedNode', () => {
lambdaDeployedNodeInput.resourceTreeEntity
)

assert(loggerErrorStub.calledOnceWith('Error getting Lambda configuration'))
assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration'))
assert(loggerErrorStub.calledOnceWith('Error getting Lambda configuration %O'))
assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration %O'))
assert(deployedResourceNodes.length === 1)

// Check placeholder propertries
Expand Down Expand Up @@ -375,10 +375,10 @@ describe('generateDeployedNode', () => {
unsupportTypeInput.resourceTreeEntity
)

assert(loggerInfoStub.calledOnceWith('Details are missing or are incomplete for:'))
assert(loggerInfoStub.calledOnceWith('Details are missing or are incomplete for: %O'))

// Check deployedResourceNodes array propertries
assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration'))
assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration %O'))

// Check deployedResourceNodes array propertries
assert(deployedResourceNodes.length === 1)
Expand Down

0 comments on commit d5151c5

Please sign in to comment.