Skip to content

Commit 924d7ca

Browse files
committed
Fix lint errors: replace 'as any' with proper type casts
1 parent e8a157f commit 924d7ca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/test/managers/builtin/uvPythonInstaller.unit.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import assert from 'assert';
22
import * as sinon from 'sinon';
33
import { LogOutputChannel } from 'vscode';
4+
import { PythonEnvironmentApi } from '../../../api';
45
import { UvInstallStrings } from '../../../common/localize';
56
import * as persistentState from '../../../common/persistentState';
67
import { EventNames } from '../../../common/telemetry/constants';
@@ -16,7 +17,7 @@ import { createMockLogOutputChannel } from '../../mocks/helper';
1617

1718
suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
1819
let mockLog: LogOutputChannel;
19-
let mockApi: { refreshEnvironments: sinon.SinonStub };
20+
let mockApi: Partial<PythonEnvironmentApi>;
2021
let isUvInstalledStub: sinon.SinonStub;
2122
let showInformationMessageStub: sinon.SinonStub;
2223
let sendTelemetryEventStub: sinon.SinonStub;
@@ -44,7 +45,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
4445
test('should return false when "Don\'t ask again" is set', async () => {
4546
mockState.get.resolves(true);
4647

47-
const result = await promptInstallPythonViaUv('activation', mockApi as any, mockLog);
48+
const result = await promptInstallPythonViaUv('activation', mockApi as PythonEnvironmentApi, mockLog);
4849

4950
assert.strictEqual(result, false);
5051
assert(showInformationMessageStub.notCalled, 'Should not show message when dont ask again is set');
@@ -56,7 +57,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
5657
isUvInstalledStub.resolves(true);
5758
showInformationMessageStub.resolves(undefined); // User dismissed
5859

59-
await promptInstallPythonViaUv('activation', mockApi as any, mockLog);
60+
await promptInstallPythonViaUv('activation', mockApi as PythonEnvironmentApi, mockLog);
6061

6162
assert(
6263
showInformationMessageStub.calledWith(
@@ -73,7 +74,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
7374
isUvInstalledStub.resolves(false);
7475
showInformationMessageStub.resolves(undefined); // User dismissed
7576

76-
await promptInstallPythonViaUv('activation', mockApi as any, mockLog);
77+
await promptInstallPythonViaUv('activation', mockApi as PythonEnvironmentApi, mockLog);
7778

7879
assert(
7980
showInformationMessageStub.calledWith(
@@ -90,7 +91,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
9091
isUvInstalledStub.resolves(true);
9192
showInformationMessageStub.resolves(UvInstallStrings.dontAskAgain);
9293

93-
const result = await promptInstallPythonViaUv('activation', mockApi as any, mockLog);
94+
const result = await promptInstallPythonViaUv('activation', mockApi as PythonEnvironmentApi, mockLog);
9495

9596
assert.strictEqual(result, false);
9697
assert(mockState.set.calledWith('python-envs:uv:UV_INSTALL_PYTHON_DONT_ASK', true), 'Should set dont ask flag');
@@ -101,7 +102,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
101102
isUvInstalledStub.resolves(true);
102103
showInformationMessageStub.resolves(undefined); // User dismissed
103104

104-
const result = await promptInstallPythonViaUv('activation', mockApi as any, mockLog);
105+
const result = await promptInstallPythonViaUv('activation', mockApi as PythonEnvironmentApi, mockLog);
105106

106107
assert.strictEqual(result, false);
107108
});
@@ -111,7 +112,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
111112
isUvInstalledStub.resolves(true);
112113
showInformationMessageStub.resolves(undefined);
113114

114-
await promptInstallPythonViaUv('createEnvironment', mockApi as any, mockLog);
115+
await promptInstallPythonViaUv('createEnvironment', mockApi as PythonEnvironmentApi, mockLog);
115116

116117
assert(
117118
sendTelemetryEventStub.calledWith(EventNames.UV_PYTHON_INSTALL_PROMPTED, undefined, {

0 commit comments

Comments
 (0)