From a05091b8fb7bd2af100bd9d9ad934780a0d939d3 Mon Sep 17 00:00:00 2001 From: julieg18 Date: Wed, 26 Apr 2023 11:49:40 -0500 Subject: [PATCH] Renaming stuff --- extension/src/setup/index.ts | 8 +- extension/src/setup/webview/contract.ts | 2 +- extension/src/test/suite/setup/index.test.ts | 12 +-- webview/src/setup/components/App.test.tsx | 84 +++++++++---------- .../setup/components/dvc/DvcEnvCommandRow.tsx | 10 +-- .../setup/components/dvc/DvcEnvDetails.tsx | 4 +- webview/src/stories/Setup.stories.tsx | 8 +- 7 files changed, 64 insertions(+), 64 deletions(-) diff --git a/extension/src/setup/index.ts b/extension/src/setup/index.ts index 11c180ed13..e55a35d5ca 100644 --- a/extension/src/setup/index.ts +++ b/extension/src/setup/index.ts @@ -339,17 +339,17 @@ export class Setup return this.sendDataToWebview() } - public async getEnvDetails(): Promise { + public async getDvcCliDetails(): Promise { const dvcPath = this.config.getCliPath() const pythonBinPath = this.config.getPythonBinPath() const cwd = getFirstWorkspaceFolder() const { args, executable } = getOptions(pythonBinPath, dvcPath, cwd || '') const commandArgs = args.length === 0 ? '' : ` ${args.join(' ')}` - const exampleCommand = executable + commandArgs + const command = executable + commandArgs return { - exampleCommand, + command, version: cwd ? await this.getCliVersion(cwd) : undefined } } @@ -368,7 +368,7 @@ export class Setup const pythonBinPath = await findPythonBinForInstall() - const dvcCliDetails = await this.getEnvDetails() + const dvcCliDetails = await this.getDvcCliDetails() this.webviewMessages.sendWebviewMessage({ canGitInitialize, diff --git a/extension/src/setup/webview/contract.ts b/extension/src/setup/webview/contract.ts index 24919b0862..37f6368837 100644 --- a/extension/src/setup/webview/contract.ts +++ b/extension/src/setup/webview/contract.ts @@ -1,5 +1,5 @@ export type DvcCliDetails = { - exampleCommand: string + command: string version: string | undefined } diff --git a/extension/src/test/suite/setup/index.test.ts b/extension/src/test/suite/setup/index.test.ts index 5879a5d4e4..b4f40a76a0 100644 --- a/extension/src/test/suite/setup/index.test.ts +++ b/extension/src/test/suite/setup/index.test.ts @@ -239,7 +239,7 @@ suite('Setup Test Suite', () => { expect(mockSendMessage).to.be.calledWithExactly({ canGitInitialize: true, cliCompatible: undefined, - dvcCliDetails: { exampleCommand: 'dvc', version: undefined }, + dvcCliDetails: { command: 'dvc', version: undefined }, hasData: false, isPythonExtensionInstalled: false, isStudioConnected: false, @@ -280,7 +280,7 @@ suite('Setup Test Suite', () => { expect(mockSendMessage).to.be.calledWithExactly({ canGitInitialize: true, cliCompatible: true, - dvcCliDetails: { exampleCommand: 'dvc', version: MIN_CLI_VERSION }, + dvcCliDetails: { command: 'dvc', version: MIN_CLI_VERSION }, hasData: false, isPythonExtensionInstalled: false, isStudioConnected: false, @@ -328,7 +328,7 @@ suite('Setup Test Suite', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: MIN_CLI_VERSION }, hasData: false, @@ -378,7 +378,7 @@ suite('Setup Test Suite', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: MIN_CLI_VERSION }, hasData: false, @@ -579,7 +579,7 @@ suite('Setup Test Suite', () => { mockRunSetup.restore() stub(config, 'isPythonExtensionUsed').returns(false) stub(config, 'getPythonBinPath').resolves(join('python')) - stub(setup, 'getEnvDetails').resolves(undefined) + stub(setup, 'getDvcCliDetails').resolves(undefined) mockVersion.resetBehavior() mockVersion @@ -639,7 +639,7 @@ suite('Setup Test Suite', () => { mockExecuteCommand.restore() mockRunSetup.restore() stub(config, 'isPythonExtensionUsed').returns(true) - stub(setup, 'getEnvDetails').resolves(undefined) + stub(setup, 'getDvcCliDetails').resolves(undefined) mockVersion.resetBehavior() mockVersion.rejects(new Error('no CLI here')) diff --git a/webview/src/setup/components/App.test.tsx b/webview/src/setup/components/App.test.tsx index fddd88d261..412222ee58 100644 --- a/webview/src/setup/components/App.test.tsx +++ b/webview/src/setup/components/App.test.tsx @@ -70,7 +70,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: false, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: '1.0.0' }, hasData: false, @@ -100,7 +100,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: undefined, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: undefined }, hasData: false, @@ -124,7 +124,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: undefined, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: undefined }, hasData: false, @@ -152,7 +152,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: undefined, dvcCliDetails: { - exampleCommand: `${defaultInterpreter} -m dvc`, + command: `${defaultInterpreter} -m dvc`, version: undefined }, hasData: false, @@ -179,7 +179,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: undefined, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: undefined }, hasData: false, @@ -206,7 +206,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: undefined, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: undefined }, hasData: false, @@ -233,7 +233,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: undefined, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: undefined }, hasData: false, @@ -260,7 +260,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -284,7 +284,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -306,7 +306,7 @@ describe('App', () => { canGitInitialize: true, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -331,7 +331,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -353,7 +353,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -375,7 +375,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -399,7 +399,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -426,7 +426,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -453,7 +453,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: true, @@ -480,7 +480,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: true, @@ -495,10 +495,10 @@ describe('App', () => { }) const envDetails = screen.getByTestId('dvc-env-details') - const exampleCommand = `1.0.0 (required >= ${MIN_CLI_VERSION} and < ${MAX_CLI_VERSION}.0.0)` + const command = `1.0.0 (required >= ${MIN_CLI_VERSION} and < ${MAX_CLI_VERSION}.0.0)` expect(within(envDetails).getByText('Version')).toBeInTheDocument() - expect(within(envDetails).getByText(exampleCommand)).toBeInTheDocument() + expect(within(envDetails).getByText(command)).toBeInTheDocument() }) it('should tell the user that version is not found if dvc is not installed', () => { @@ -506,7 +506,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: false, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: undefined }, hasData: false, @@ -520,19 +520,19 @@ describe('App', () => { shareLiveToStudio: false }) const envDetails = screen.getByTestId('dvc-env-details') - const exampleCommand = `Not found (required >= ${MIN_CLI_VERSION} and < ${MAX_CLI_VERSION}.0.0)` + const command = `Not found (required >= ${MIN_CLI_VERSION} and < ${MAX_CLI_VERSION}.0.0)` expect(within(envDetails).getByText('Version')).toBeInTheDocument() - expect(within(envDetails).getByText(exampleCommand)).toBeInTheDocument() + expect(within(envDetails).getByText(command)).toBeInTheDocument() }) it('should show the user an example command if dvc is installed', () => { - const exampleCommand = 'python -m dvc' + const command = 'python -m dvc' renderApp({ canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand, + command, version: '1.0.0' }, hasData: true, @@ -549,7 +549,7 @@ describe('App', () => { const envDetails = screen.getByTestId('dvc-env-details') expect(within(envDetails).getByText('Command')).toBeInTheDocument() - expect(within(envDetails).getByText(exampleCommand)).toBeInTheDocument() + expect(within(envDetails).getByText(command)).toBeInTheDocument() }) it('should show user an example command with a "Configure" button if dvc is installed without the python extension', () => { @@ -557,7 +557,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: '1.0.0' }, hasData: true, @@ -595,7 +595,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: true, @@ -637,7 +637,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -659,7 +659,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -688,7 +688,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: false, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: undefined }, hasData: false, @@ -710,7 +710,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: true, @@ -734,7 +734,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -756,7 +756,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: undefined, @@ -778,7 +778,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -802,7 +802,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: true, @@ -831,7 +831,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -855,7 +855,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -883,7 +883,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -911,7 +911,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -942,7 +942,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -970,7 +970,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, @@ -997,7 +997,7 @@ describe('App', () => { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'python -m dvc', + command: 'python -m dvc', version: '1.0.0' }, hasData: false, diff --git a/webview/src/setup/components/dvc/DvcEnvCommandRow.tsx b/webview/src/setup/components/dvc/DvcEnvCommandRow.tsx index d3291b1234..82c763087d 100644 --- a/webview/src/setup/components/dvc/DvcEnvCommandRow.tsx +++ b/webview/src/setup/components/dvc/DvcEnvCommandRow.tsx @@ -4,16 +4,16 @@ import styles from './styles.module.scss' import { selectPythonInterpreter, setupWorkspace } from '../messages' interface DvcEnvCommandRowProps { - exampleCommand: string + command: string isPythonExtensionInstalled: boolean } export const DvcEnvCommandRow: React.FC = ({ - exampleCommand, + command, isPythonExtensionInstalled }) => { - const commandText = exampleCommand || 'Not found' - const command = ( + const commandText = command || 'Not found' + const commandValue = ( <> {commandText} @@ -35,5 +35,5 @@ export const DvcEnvCommandRow: React.FC = ({ ) - return + return } diff --git a/webview/src/setup/components/dvc/DvcEnvDetails.tsx b/webview/src/setup/components/dvc/DvcEnvDetails.tsx index ab6546aeeb..e63bf90181 100644 --- a/webview/src/setup/components/dvc/DvcEnvDetails.tsx +++ b/webview/src/setup/components/dvc/DvcEnvDetails.tsx @@ -10,7 +10,7 @@ interface DvcEnvDetailsProps extends DvcCliDetails { } export const DvcEnvDetails: React.FC = ({ - exampleCommand, + command, version, isPythonExtensionInstalled }) => { @@ -23,7 +23,7 @@ export const DvcEnvDetails: React.FC = ({ {version && ( )} diff --git a/webview/src/stories/Setup.stories.tsx b/webview/src/stories/Setup.stories.tsx index 1076f81eae..8b87ed9afc 100644 --- a/webview/src/stories/Setup.stories.tsx +++ b/webview/src/stories/Setup.stories.tsx @@ -9,7 +9,7 @@ const DEFAULT_DATA: SetupData = { canGitInitialize: false, cliCompatible: true, dvcCliDetails: { - exampleCommand: 'path/to/python -m dvc', + command: 'path/to/python -m dvc', version: '1.0.0' }, hasData: false, @@ -77,7 +77,7 @@ export const NoCLIPythonNotFound = Template.bind({}) NoCLIPythonNotFound.args = getUpdatedArgs({ cliCompatible: undefined, dvcCliDetails: { - exampleCommand: 'dvc', + command: 'dvc', version: undefined }, isPythonExtensionInstalled: false, @@ -88,7 +88,7 @@ export const NoCLIPythonExtensionUsed = Template.bind({}) NoCLIPythonExtensionUsed.args = getUpdatedArgs({ cliCompatible: undefined, dvcCliDetails: { - exampleCommand: '/opt/homebrew/Caskroom/miniforge/base/bin/python -m dvc', + command: '/opt/homebrew/Caskroom/miniforge/base/bin/python -m dvc', version: undefined }, isPythonExtensionInstalled: true, @@ -99,7 +99,7 @@ export const NoCLIPythonExtensionNotUsed = Template.bind({}) NoCLIPythonExtensionNotUsed.args = getUpdatedArgs({ cliCompatible: undefined, dvcCliDetails: { - exampleCommand: '.env/bin/python -m dvc', + command: '.env/bin/python -m dvc', version: undefined }, isPythonExtensionInstalled: false,