From 2bf402e72617c0d2db79123b944bf64f5dfa00c7 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Fri, 18 Jan 2019 12:09:33 -0800 Subject: [PATCH] Fixed tests --- .../diagnostics/checks/envPathVariable.unit.test.ts | 7 ++++++- .../diagnostics/checks/lsNotSupported.unit.test.ts | 6 ++++++ .../diagnostics/checks/powerShellActivation.unit.test.ts | 8 +++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts b/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts index 4e39d95a9aca3..511f0ed7f8376 100644 --- a/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts +++ b/src/test/application/diagnostics/checks/envPathVariable.unit.test.ts @@ -13,7 +13,7 @@ import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/ap import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, MessageCommandPrompt } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, IDiagnosticFilterService, IDiagnosticHandlerService, IDiagnosticsService } from '../../../../client/application/diagnostics/types'; -import { IApplicationEnvironment } from '../../../../client/common/application/types'; +import { IApplicationEnvironment, IWorkspaceService } from '../../../../client/common/application/types'; import { IPlatformService } from '../../../../client/common/platform/types'; import { ICurrentProcess, IPathUtils } from '../../../../client/common/types'; import { EnvironmentVariables } from '../../../../client/common/variables/types'; @@ -65,6 +65,11 @@ suite('Application Diagnostics - Checks Env Path Variable', () => { pathUtils.setup(p => p.delimiter).returns(() => pathDelimiter); serviceContainer.setup(s => s.get(typemoq.It.isValue(IPathUtils))) .returns(() => pathUtils.object); + const workspaceService = typemoq.Mock.ofType(); + serviceContainer.setup(s => s.get(typemoq.It.isValue(IWorkspaceService))) + .returns(() => workspaceService.object); + workspaceService.setup(w => w.getWorkspaceFolder(typemoq.It.isAny())) + .returns(() => undefined); diagnosticService = new class extends EnvironmentPathVariableDiagnosticsService { public _clear() { diff --git a/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts b/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts index 756ced89760c6..1b0f12ec96b80 100644 --- a/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts +++ b/src/test/application/diagnostics/checks/lsNotSupported.unit.test.ts @@ -12,6 +12,7 @@ import { CommandOption, IDiagnosticsCommandFactory } from '../../../../client/ap import { DiagnosticCodes } from '../../../../client/application/diagnostics/constants'; import { DiagnosticCommandPromptHandlerServiceId, MessageCommandPrompt } from '../../../../client/application/diagnostics/promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand, IDiagnosticFilterService, IDiagnosticHandlerService, IDiagnosticsService } from '../../../../client/application/diagnostics/types'; +import { IWorkspaceService } from '../../../../client/common/application/types'; import { IServiceContainer } from '../../../../client/ioc/types'; // tslint:disable:max-func-body-length no-any @@ -31,6 +32,11 @@ suite('Application Diagnostics - Checks LS not supported', () => { serviceContainer.setup(s => s.get(TypeMoq.It.isValue(IDiagnosticFilterService))).returns(() => filterService.object); serviceContainer.setup(s => s.get(TypeMoq.It.isValue(IDiagnosticsCommandFactory))).returns(() => commandFactory.object); serviceContainer.setup(s => s.get(TypeMoq.It.isValue(IDiagnosticHandlerService), TypeMoq.It.isValue(DiagnosticCommandPromptHandlerServiceId))).returns(() => messageHandler.object); + const workspaceService = TypeMoq.Mock.ofType(); + serviceContainer.setup(s => s.get(TypeMoq.It.isValue(IWorkspaceService))) + .returns(() => workspaceService.object); + workspaceService.setup(w => w.getWorkspaceFolder(TypeMoq.It.isAny())) + .returns(() => undefined); diagnosticService = new class extends LSNotSupportedDiagnosticService { public _clear() { diff --git a/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts b/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts index cfd5859ed96f1..fcbc7b52b1192 100644 --- a/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts +++ b/src/test/application/diagnostics/checks/powerShellActivation.unit.test.ts @@ -21,7 +21,7 @@ import { IDiagnosticHandlerService, IDiagnosticsService } from '../../../../client/application/diagnostics/types'; -import { IApplicationEnvironment } from '../../../../client/common/application/types'; +import { IApplicationEnvironment, IWorkspaceService } from '../../../../client/common/application/types'; import { IPlatformService } from '../../../../client/common/platform/types'; import { ICurrentProcess, IPathUtils } from '../../../../client/common/types'; import { EnvironmentVariables } from '../../../../client/common/variables/types'; @@ -78,6 +78,12 @@ suite('Application Diagnostics - PowerShell Activation', () => { pathUtils.setup(p => p.delimiter).returns(() => pathDelimiter); serviceContainer.setup(s => s.get(typemoq.It.isValue(IPathUtils))).returns(() => pathUtils.object); + const workspaceService = typemoq.Mock.ofType(); + serviceContainer.setup(s => s.get(typemoq.It.isValue(IWorkspaceService))) + .returns(() => workspaceService.object); + workspaceService.setup(w => w.getWorkspaceFolder(typemoq.It.isAny())) + .returns(() => undefined); + diagnosticService = new class extends PowerShellActivationHackDiagnosticsService { public _clear() { while (BaseDiagnosticsService.handledDiagnosticCodeKeys.length > 0) {