From 941b159dd2f764934e7aebcec37cb6aeb3335c75 Mon Sep 17 00:00:00 2001 From: Stephen Carter Date: Tue, 16 Jan 2024 15:19:58 -0500 Subject: [PATCH] @W-14689540@: (Part 8) Implemening review feedback --- __tests__/commands.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/__tests__/commands.test.ts b/__tests__/commands.test.ts index a26da80..fef411e 100644 --- a/__tests__/commands.test.ts +++ b/__tests__/commands.test.ts @@ -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) @@ -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({ @@ -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)