@@ -79,6 +79,8 @@ const mockedSetRoots = jest.fn()
7979const mockedSetupWorkspace = jest . fn ( )
8080const mockedUnsetPythonBinPath = jest . fn ( )
8181
82+ const mockedSetConfigToUsePythonExtension = jest . fn ( )
83+
8284const mockedQuickPickYesOrNo = jest . mocked ( quickPickYesOrNo )
8385const mockedQuickPickValue = jest . mocked ( quickPickValue )
8486const mockedSetConfigValue = jest . mocked ( setConfigValue )
@@ -105,7 +107,7 @@ describe('setupWorkspace', () => {
105107 it ( 'should present two options if the python extension is installed (Auto & Global)' , async ( ) => {
106108 mockedQuickPickValue . mockResolvedValueOnce ( undefined )
107109
108- await setupWorkspace ( )
110+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
109111
110112 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
111113 expect ( mockedQuickPickValue ) . toHaveBeenCalledWith (
@@ -123,7 +125,7 @@ describe('setupWorkspace', () => {
123125 it ( 'should present two options if the python extension is NOT installed (Manual & Global)' , async ( ) => {
124126 mockedExtensions . all = [ ]
125127
126- await setupWorkspace ( )
128+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
127129
128130 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
129131 expect ( mockedQuickPickValue ) . toHaveBeenCalledWith (
@@ -141,9 +143,10 @@ describe('setupWorkspace', () => {
141143 it ( 'should set the dvc path and python path options to undefined if the CLI is being auto detected inside a virtual environment' , async ( ) => {
142144 mockedQuickPickValue . mockResolvedValueOnce ( 2 )
143145
144- await setupWorkspace ( )
146+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
145147
146148 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
149+ expect ( mockedSetConfigToUsePythonExtension ) . toHaveBeenCalledTimes ( 1 )
147150 expect ( mockedSetConfigValue ) . toHaveBeenCalledWith (
148151 ConfigKey . DVC_PATH ,
149152 undefined
@@ -158,7 +161,7 @@ describe('setupWorkspace', () => {
158161 mockedQuickPickValue . mockResolvedValueOnce ( 1 )
159162 mockedQuickPickOneOrInput . mockResolvedValueOnce ( undefined )
160163
161- await setupWorkspace ( )
164+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
162165
163166 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
164167 expect ( mockedQuickPickOneOrInput ) . toHaveBeenCalledTimes ( 1 )
@@ -173,8 +176,9 @@ describe('setupWorkspace', () => {
173176 mockedQuickPickOneOrInput . mockResolvedValueOnce ( 'pick' )
174177 mockedPickFile . mockResolvedValueOnce ( mockedPythonPath )
175178
176- await setupWorkspace ( )
179+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
177180
181+ expect ( mockedSetConfigToUsePythonExtension ) . not . toHaveBeenCalled ( )
178182 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
179183 expect ( mockedQuickPickYesOrNo ) . toHaveBeenCalledTimes ( 2 )
180184 expect ( mockedQuickPickOneOrInput ) . toHaveBeenCalledTimes ( 1 )
@@ -190,7 +194,7 @@ describe('setupWorkspace', () => {
190194 it ( 'should return without setting any options if the dialog is cancelled at the virtual environment step' , async ( ) => {
191195 mockedQuickPickValue . mockResolvedValueOnce ( undefined )
192196
193- await setupWorkspace ( )
197+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
194198
195199 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
196200 expect ( mockedSetConfigValue ) . not . toHaveBeenCalled ( )
@@ -208,7 +212,7 @@ describe('setupWorkspace', () => {
208212 . mockResolvedValueOnce ( mockedPythonPath )
209213 . mockResolvedValueOnce ( mockedDvcPath )
210214
211- await setupWorkspace ( )
215+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
212216
213217 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
214218 expect ( mockedQuickPickYesOrNo ) . toHaveBeenCalledTimes ( 2 )
@@ -229,7 +233,7 @@ describe('setupWorkspace', () => {
229233 mockedQuickPickValue . mockResolvedValueOnce ( 1 )
230234 mockedQuickPickOneOrInput . mockResolvedValueOnce ( undefined )
231235
232- await setupWorkspace ( )
236+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
233237
234238 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
235239 expect ( mockedQuickPickYesOrNo ) . not . toHaveBeenCalled ( )
@@ -247,7 +251,7 @@ describe('setupWorkspace', () => {
247251 mockedQuickPickOneOrInput . mockResolvedValueOnce ( 'pick' )
248252 mockedPickFile . mockResolvedValueOnce ( mockedDvcPath )
249253
250- await setupWorkspace ( )
254+ await setupWorkspace ( mockedSetConfigToUsePythonExtension )
251255
252256 expect ( mockedQuickPickValue ) . toHaveBeenCalledTimes ( 1 )
253257 expect ( mockedQuickPickYesOrNo ) . toHaveBeenCalledTimes ( 2 )
0 commit comments