diff --git a/src/test/interpreters/display/progressDisplay.unit.test.ts b/src/test/interpreters/display/progressDisplay.unit.test.ts index 433fbfe950c9..77c5f16f4471 100644 --- a/src/test/interpreters/display/progressDisplay.unit.test.ts +++ b/src/test/interpreters/display/progressDisplay.unit.test.ts @@ -12,6 +12,7 @@ import { createDeferred, Deferred } from '../../../client/common/utils/async'; import { Interpreters } from '../../../client/common/utils/localize'; import { IComponentAdapter } from '../../../client/interpreter/contracts'; import { InterpreterLocatorProgressStatubarHandler } from '../../../client/interpreter/display/progressDisplay'; +import { ProgressNotificationEvent, ProgressReportStage } from '../../../client/pythonEnvironments/base/locator'; import { noop } from '../../core'; type ProgressTask = ( @@ -20,18 +21,18 @@ type ProgressTask = ( ) => Thenable; suite('Interpreters - Display Progress', () => { - let refreshingCallback: (e: void) => unknown | undefined; + let refreshingCallback: (e: ProgressNotificationEvent) => unknown | undefined; let refreshDeferred: Deferred; let componentAdapter: IComponentAdapter; setup(() => { refreshDeferred = createDeferred(); componentAdapter = { // eslint-disable-next-line @typescript-eslint/no-explicit-any - onRefreshStart(listener: (e: void) => any): Disposable { + onProgress(listener: (e: ProgressNotificationEvent) => any): Disposable { refreshingCallback = listener; return { dispose: noop }; }, - refreshPromise: refreshDeferred.promise, + getRefreshPromise: () => refreshDeferred.promise, // eslint-disable-next-line @typescript-eslint/no-explicit-any } as any; }); @@ -44,7 +45,7 @@ suite('Interpreters - Display Progress', () => { when(shell.withProgress(anything(), anything())).thenResolve(); await statusBar.activate(); - refreshingCallback(undefined); + refreshingCallback({ stage: ProgressReportStage.discoveryStarted }); const options = capture(shell.withProgress as never).last()[0] as ProgressOptions; expect(options.title).to.be.equal(`[${Interpreters.discovering}](command:${Commands.Set_Interpreter})`); @@ -56,12 +57,12 @@ suite('Interpreters - Display Progress', () => { when(shell.withProgress(anything(), anything())).thenResolve(); await statusBar.activate(); - refreshingCallback(undefined); + refreshingCallback({ stage: ProgressReportStage.discoveryStarted }); let options = capture(shell.withProgress as never).last()[0] as ProgressOptions; expect(options.title).to.be.equal(`[${Interpreters.discovering}](command:${Commands.Set_Interpreter})`); - refreshingCallback(undefined); + refreshingCallback({ stage: ProgressReportStage.discoveryStarted }); options = capture(shell.withProgress as never).last()[0] as ProgressOptions; expect(options.title).to.be.equal(`[${Interpreters.refreshing}](command:${Commands.Set_Interpreter})`); @@ -73,7 +74,7 @@ suite('Interpreters - Display Progress', () => { when(shell.withProgress(anything(), anything())).thenResolve(); await statusBar.activate(); - refreshingCallback(undefined); + refreshingCallback({ stage: ProgressReportStage.discoveryStarted }); const options = capture(shell.withProgress as never).last()[0] as ProgressOptions; const callback = capture(shell.withProgress as never).last()[1] as ProgressTask; diff --git a/src/test/proposedApi.unit.test.ts b/src/test/proposedApi.unit.test.ts index c4f60e5d159f..1bcef0717db7 100644 --- a/src/test/proposedApi.unit.test.ts +++ b/src/test/proposedApi.unit.test.ts @@ -9,7 +9,11 @@ import { IInterpreterPathService } from '../client/common/types'; import { IInterpreterService } from '../client/interpreter/contracts'; import { IServiceContainer } from '../client/ioc/types'; import { buildProposedApi } from '../client/proposedApi'; -import { IDiscoveryAPI, ProgressNotificationEvent } from '../client/pythonEnvironments/base/locator'; +import { + IDiscoveryAPI, + ProgressNotificationEvent, + ProgressReportStage, +} from '../client/pythonEnvironments/base/locator'; import { PythonEnvironment } from '../client/pythonEnvironments/info'; import { PythonEnvKind, PythonEnvSource } from '../client/pythonEnvironments/base/info'; import { Architecture } from '../client/common/utils/platform'; @@ -389,8 +393,10 @@ suite('Proposed Extension API', () => { test('getRefreshPromise: common scenario', () => { const expected = Promise.resolve(); - discoverAPI.setup((d) => d.getRefreshPromise()).returns(() => expected); - const actual = proposed.environment.getRefreshPromise(); + discoverAPI + .setup((d) => d.getRefreshPromise(typemoq.It.isValue({ stage: ProgressReportStage.allPathsDiscovered }))) + .returns(() => expected); + const actual = proposed.environment.getRefreshPromise({ stage: ProgressReportStage.allPathsDiscovered }); // We are comparing instances here, they should be the same instance. // So '==' is ok here.