Skip to content

Commit 7680614

Browse files
author
Kartik Raj
committed
Update unit tests
1 parent 59d72f7 commit 7680614

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/test/common/interpreterPathService.unit.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
workspaceFolderKeysForWhichTheCopyIsDone_Key,
2323
workspaceKeysForWhichTheCopyIsDone_Key
2424
} from '../../client/common/interpreterPathService';
25+
import { FileSystemPaths } from '../../client/common/platform/fs-paths';
2526
import { InterpreterConfigurationScope, IPersistentState, IPersistentStateFactory } from '../../client/common/types';
2627
import { createDeferred, sleep } from '../../client/common/utils/async';
2728

@@ -32,6 +33,7 @@ suite('Interpreter Path Service', async () => {
3233
const resource = Uri.parse('a');
3334
const resourceOutsideOfWorkspace = Uri.parse('b');
3435
const interpreterPath = 'path/to/interpreter';
36+
const fs = FileSystemPaths.withDefaults();
3537
setup(() => {
3638
const event = TypeMoq.Mock.ofType<Event<ConfigurationChangeEvent>>();
3739
workspaceService = TypeMoq.Mock.ofType<IWorkspaceService>();
@@ -126,7 +128,7 @@ suite('Interpreter Path Service', async () => {
126128

127129
test('If the one-off transfer to new storage has not happened yet for the workspace, do it and record the transfer', async () => {
128130
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
129-
const expectedWorkspaceKey = 'PATH\\TO\\WORKSPACEFILE';
131+
const expectedWorkspaceKey = fs.normCase(workspaceFileUri.fsPath);
130132
const update = sinon.stub(InterpreterPathService.prototype, 'update');
131133
const persistentState = TypeMoq.Mock.ofType<IPersistentState<string[]>>();
132134
workspaceService.setup((w) => w.workspaceFile).returns(() => workspaceFileUri);
@@ -148,7 +150,7 @@ suite('Interpreter Path Service', async () => {
148150

149151
test('If the one-off transfer to new storage has already happened for the workspace, do not update and simply return', async () => {
150152
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
151-
const expectedWorkspaceKey = 'PATH\\TO\\WORKSPACEFILE';
153+
const expectedWorkspaceKey = fs.normCase(workspaceFileUri.fsPath);
152154
const update = sinon.stub(InterpreterPathService.prototype, 'update');
153155
const persistentState = TypeMoq.Mock.ofType<IPersistentState<string[]>>();
154156
workspaceService.setup((w) => w.workspaceFile).returns(() => workspaceFileUri);
@@ -330,7 +332,7 @@ suite('Interpreter Path Service', async () => {
330332

331333
test('Workspace settings are correctly updated in case of multiroot folders', async () => {
332334
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
333-
const expectedSettingKey = 'WORKSPACE_INTERPRETER_PATH_PATH\\TO\\WORKSPACEFILE';
335+
const expectedSettingKey = `WORKSPACE_INTERPRETER_PATH_${fs.normCase(workspaceFileUri.fsPath)}`;
334336
const persistentState = TypeMoq.Mock.ofType<IPersistentState<string | undefined>>();
335337
workspaceService.setup((w) => w.getWorkspaceFolderIdentifier(resource)).returns(() => resource.fsPath);
336338
workspaceService.setup((w) => w.workspaceFile).returns(() => workspaceFileUri);
@@ -507,7 +509,7 @@ suite('Interpreter Path Service', async () => {
507509

508510
test('Inspecting settings returns as expected in case of multiroot folders', async () => {
509511
const workspaceFileUri = Uri.parse('path/to/workspaceFile');
510-
const expectedWorkspaceSettingKey = 'WORKSPACE_INTERPRETER_PATH_PATH\\TO\\WORKSPACEFILE';
512+
const expectedWorkspaceSettingKey = `WORKSPACE_INTERPRETER_PATH_${fs.normCase(workspaceFileUri.fsPath)}`;
511513
const expectedWorkspaceFolderSettingKey = `WORKSPACE_FOLDER_INTERPRETER_PATH_${resource.fsPath}`;
512514
const workspaceConfig = TypeMoq.Mock.ofType<WorkspaceConfiguration>();
513515
// A workspace file is present in case of multiroot workspace folders

0 commit comments

Comments
 (0)