Skip to content

Commit

Permalink
@W-14689540@: (Part 8) Implemening review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-carter-at-sf committed Jan 16, 2024
1 parent 1a98eb1 commit 941b159
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions __tests__/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ describe('RuntimeCommandExecutor Tests', () => {
})

describe('isMinimumScannerPluginInstalled Tests', () => {
const sampleResponseJson =
const createSampleResponse = (versionNumber: string): string =>
'[\n' +
' {\n' +
' "name": "@salesforce/sfdx-scanner",\n' +
' "version": "3.21.0",\n' +
` "version": "${versionNumber}",\n` +
' "aBunchOfOtherFields": "thatWeDon\'tCareAbout"\n' +
' }\n' +
']'

it('Check when scanner plugin is installed with a version less than the minimum version', async () => {
dependencies.execCommandReturnValue = { exitCode: 0, stdout: sampleResponseJson, stderr: '' }
dependencies.execCommandReturnValue = { exitCode: 0, stdout: createSampleResponse('3.9.0'), stderr: '' }
const tf: boolean = await commandExecutor.isMinimumScannerPluginInstalled('3.22.0')

expect(dependencies.execCommandCallHistory).toHaveLength(1)
Expand All @@ -143,8 +143,8 @@ describe('RuntimeCommandExecutor Tests', () => {
})

it('Check when scanner plugin is installed with a version exactly same as minimum version', async () => {
dependencies.execCommandReturnValue = { exitCode: 0, stdout: sampleResponseJson, stderr: '' }
const tf: boolean = await commandExecutor.isMinimumScannerPluginInstalled('3.21.0')
dependencies.execCommandReturnValue = { exitCode: 0, stdout: createSampleResponse('3.20.0'), stderr: '' }
const tf: boolean = await commandExecutor.isMinimumScannerPluginInstalled('3.20.0')

expect(dependencies.execCommandCallHistory).toHaveLength(1)
expect(dependencies.execCommandCallHistory).toContainEqual({
Expand All @@ -156,7 +156,7 @@ describe('RuntimeCommandExecutor Tests', () => {
})

it('Check when scanner plugin is installed with a version greater than the minimum version', async () => {
dependencies.execCommandReturnValue = { exitCode: 0, stdout: sampleResponseJson, stderr: '' }
dependencies.execCommandReturnValue = { exitCode: 0, stdout: createSampleResponse('3.21.0'), stderr: '' }
const tf: boolean = await commandExecutor.isMinimumScannerPluginInstalled('3.20.0')

expect(dependencies.execCommandCallHistory).toHaveLength(1)
Expand Down

0 comments on commit 941b159

Please sign in to comment.