Skip to content

Commit a28d783

Browse files
committed
fix windowsFinder tests
1 parent bf85a03 commit a28d783

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/vs/code/test/node/windowsFinder.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { findBestWindowOrFolderForFile, ISimpleWindow, IBestWindowOrFolderOption
1010
import { OpenContext } from 'vs/platform/windows/common/windows';
1111
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
1212
import { toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
13+
import URI from 'vs/base/common/uri';
1314

1415
const fixturesFolder = require.toUrl('./fixtures');
1516

@@ -30,10 +31,10 @@ function options(custom?: Partial<IBestWindowOrFolderOptions<ISimpleWindow>>): I
3031
};
3132
}
3233

33-
const vscodeFolderWindow = { lastFocusTime: 1, openedFolderPath: path.join(fixturesFolder, 'vscode_folder') };
34-
const lastActiveWindow = { lastFocusTime: 3, openedFolderPath: null };
35-
const noVscodeFolderWindow = { lastFocusTime: 2, openedFolderPath: path.join(fixturesFolder, 'no_vscode_folder') };
36-
const windows = [
34+
const vscodeFolderWindow: ISimpleWindow = { lastFocusTime: 1, openedFolderUri: URI.file(path.join(fixturesFolder, 'vscode_folder')) };
35+
const lastActiveWindow: ISimpleWindow = { lastFocusTime: 3, openedFolderUri: null };
36+
const noVscodeFolderWindow: ISimpleWindow = { lastFocusTime: 2, openedFolderUri: URI.file(path.join(fixturesFolder, 'no_vscode_folder')) };
37+
const windows: ISimpleWindow[] = [
3738
vscodeFolderWindow,
3839
lastActiveWindow,
3940
noVscodeFolderWindow,
@@ -103,24 +104,24 @@ suite('WindowsFinder', () => {
103104
windows,
104105
filePath: path.join(fixturesFolder, 'vscode_folder', 'file.txt')
105106
})), vscodeFolderWindow);
106-
const window = { lastFocusTime: 1, openedFolderPath: path.join(fixturesFolder, 'vscode_folder', 'nested_folder') };
107+
const window: ISimpleWindow = { lastFocusTime: 1, openedFolderUri: URI.file(path.join(fixturesFolder, 'vscode_folder', 'nested_folder')) };
107108
assert.equal(findBestWindowOrFolderForFile(options({
108109
windows: [window],
109110
filePath: path.join(fixturesFolder, 'vscode_folder', 'nested_folder', 'subfolder', 'file.txt')
110111
})), window);
111112
});
112113

113114
test('More specific existing window wins', () => {
114-
const window = { lastFocusTime: 2, openedFolderPath: path.join(fixturesFolder, 'no_vscode_folder') };
115-
const nestedFolderWindow = { lastFocusTime: 1, openedFolderPath: path.join(fixturesFolder, 'no_vscode_folder', 'nested_folder') };
115+
const window: ISimpleWindow = { lastFocusTime: 2, openedFolderUri: URI.file(path.join(fixturesFolder, 'no_vscode_folder')) };
116+
const nestedFolderWindow: ISimpleWindow = { lastFocusTime: 1, openedFolderUri: URI.file(path.join(fixturesFolder, 'no_vscode_folder', 'nested_folder')) };
116117
assert.equal(findBestWindowOrFolderForFile(options({
117118
windows: [window, nestedFolderWindow],
118119
filePath: path.join(fixturesFolder, 'no_vscode_folder', 'nested_folder', 'subfolder', 'file.txt')
119120
})), nestedFolderWindow);
120121
});
121122

122123
test('Workspace folder wins', () => {
123-
const window = { lastFocusTime: 1, openedWorkspace: testWorkspace };
124+
const window: ISimpleWindow = { lastFocusTime: 1, openedWorkspace: testWorkspace };
124125
assert.equal(findBestWindowOrFolderForFile(options({
125126
windows: [window],
126127
filePath: path.join(fixturesFolder, 'vscode_workspace_2_folder', 'nested_vscode_folder', 'subfolder', 'file.txt')

0 commit comments

Comments
 (0)