Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TwitchBronBron committed Oct 18, 2022
1 parent 79ee975 commit b915e84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/LanguageServerManager.spec.ts
Expand Up @@ -242,7 +242,8 @@ describe('extension', () => {
value = null;
}
return {
get: x => value
get: x => value,
inspect: () => ({}) as any
};
});
vscode.workspace.workspaceFolders.push({
Expand Down
12 changes: 9 additions & 3 deletions src/mockVscode.spec.ts
@@ -1,4 +1,4 @@
import type { Command, Range, TreeDataProvider, TreeItemCollapsibleState, Uri, WorkspaceFolder, ConfigurationScope, ExtensionContext } from 'vscode';
import type { Command, Range, TreeDataProvider, TreeItemCollapsibleState, Uri, WorkspaceFolder, ConfigurationScope, ExtensionContext, WorkspaceConfiguration } from 'vscode';

afterEach(() => {
delete vscode.workspace.workspaceFile;
Expand Down Expand Up @@ -76,10 +76,10 @@ export let vscode = {
globalStoragePath: '',
globalState: {
_data: {},
update: function (key: string, value: any) {
update: function(key: string, value: any) {
this._data[key] = value;
},
get: function (key: string) {
get: function(key: string) {
return this._data[key];
}
} as any,
Expand Down Expand Up @@ -111,6 +111,12 @@ export let vscode = {
return {
get: (name: string) => {
return this._configuration?.[`${configurationName}.${name}`];
},
inspect: (name: string) => {
return {
key: name,
globalValue: this._configuration?.[`${configurationName}.${name}`]
} as ReturnType<WorkspaceConfiguration['inspect']>;
}
};
},
Expand Down

0 comments on commit b915e84

Please sign in to comment.