Skip to content

Commit ed1b43d

Browse files
committed
Fix terminal helper tests
1 parent 84de6ff commit ed1b43d

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/test/common/terminals/helper.unit.test.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ suite('Terminal Service helpers', () => {
211211
const cmd = await helper.getEnvironmentActivationCommands(anything(), resource);
212212

213213
expect(cmd).to.equal(condaActivationCommands);
214-
verify(pythonSettings.pythonPath).once();
215-
verify(condaService.isCondaEnvironment(pythonPath)).once();
214+
verify(pythonSettings.pythonPath).atLeast(1);
215+
verify(condaService.isCondaEnvironment(pythonPath)).atLeast(1);
216216
verify(condaActivationProvider.getActivationCommands(resource, anything())).once();
217217
});
218218
test('Activation command must return undefined if none of the proivders support the shell', async () => {
@@ -231,8 +231,8 @@ suite('Terminal Service helpers', () => {
231231
);
232232

233233
expect(cmd).to.equal(undefined, 'Command must be undefined');
234-
verify(pythonSettings.pythonPath).once();
235-
verify(condaService.isCondaEnvironment(pythonPath)).once();
234+
verify(pythonSettings.pythonPath).atLeast(1);
235+
verify(condaService.isCondaEnvironment(pythonPath)).atLeast(1);
236236
verify(bashActivationProvider.isShellSupported(anything())).atLeast(1);
237237
verify(nushellActivationProvider.isShellSupported(anything())).atLeast(1);
238238
verify(pyenvActivationProvider.isShellSupported(anything())).atLeast(1);
@@ -255,8 +255,8 @@ suite('Terminal Service helpers', () => {
255255
const cmd = await helper.getEnvironmentActivationCommands(anything(), resource);
256256

257257
expect(cmd).to.deep.equal(expectCommand);
258-
verify(pythonSettings.pythonPath).once();
259-
verify(condaService.isCondaEnvironment(pythonPath)).once();
258+
verify(pythonSettings.pythonPath).atLeast(1);
259+
verify(condaService.isCondaEnvironment(pythonPath)).atLeast(1);
260260
verify(bashActivationProvider.isShellSupported(anything())).atLeast(1);
261261
verify(bashActivationProvider.getActivationCommands(resource, anything())).once();
262262
verify(nushellActivationProvider.isShellSupported(anything())).atLeast(1);
@@ -287,7 +287,7 @@ suite('Terminal Service helpers', () => {
287287
const cmd = await helper.getEnvironmentActivationCommands(anything(), resource);
288288

289289
expect(cmd).to.deep.equal(expectCommand);
290-
verify(pythonSettings.pythonPath).once();
290+
verify(pythonSettings.pythonPath).atLeast(1);
291291
verify(condaService.isCondaEnvironment(pythonPath)).once();
292292
verify(bashActivationProvider.isShellSupported(anything())).atLeast(1);
293293
verify(bashActivationProvider.getActivationCommands(resource, anything())).never();
@@ -313,7 +313,7 @@ suite('Terminal Service helpers', () => {
313313
const cmd = await helper.getEnvironmentActivationCommands(anything(), resource);
314314

315315
expect(cmd).to.deep.equal(expectCommand);
316-
verify(pythonSettings.pythonPath).once();
316+
verify(pythonSettings.pythonPath).atLeast(1);
317317
verify(condaService.isCondaEnvironment(pythonPath)).once();
318318
verify(bashActivationProvider.isShellSupported(anything())).atLeast(1);
319319
verify(nushellActivationProvider.isShellSupported(anything())).atLeast(1);
@@ -340,7 +340,7 @@ suite('Terminal Service helpers', () => {
340340
const cmd = await helper.getEnvironmentActivationCommands(anything(), resource);
341341

342342
expect(cmd).to.deep.equal(expectCommand);
343-
verify(pythonSettings.pythonPath).once();
343+
verify(pythonSettings.pythonPath).atLeast(1);
344344
verify(condaService.isCondaEnvironment(pythonPath)).once();
345345
verify(bashActivationProvider.getActivationCommands(resource, anything())).once();
346346
verify(cmdActivationProvider.getActivationCommands(resource, anything())).once();
@@ -387,8 +387,13 @@ suite('Terminal Service helpers', () => {
387387
);
388388

389389
expect(cmd).to.equal(undefined, 'Command must be undefined');
390-
verify(pythonSettings.pythonPath).times(interpreter ? 0 : 1);
391-
verify(condaService.isCondaEnvironment(pythonPath)).times(interpreter ? 0 : 1);
390+
if (interpreter) {
391+
verify(pythonSettings.pythonPath).never();
392+
verify(condaService.isCondaEnvironment(pythonPath)).never();
393+
} else {
394+
verify(pythonSettings.pythonPath).atLeast(1);
395+
verify(condaService.isCondaEnvironment(pythonPath)).atLeast(1);
396+
}
392397
verify(bashActivationProvider.isShellSupported(shellToExpect)).atLeast(1);
393398
verify(pyenvActivationProvider.isShellSupported(anything())).never();
394399
verify(pipenvActivationProvider.isShellSupported(anything())).never();

0 commit comments

Comments
 (0)