Skip to content

Commit 6b9a034

Browse files
committed
Another null vs undefined fix
1 parent fff795d commit 6b9a034

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

test/unitTests/options.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,33 @@ suite("Options tests", () => {
4040

4141
test('Verify return no excluded paths when files.exclude empty', () => {
4242
const vscode = getVSCodeWithConfig();
43-
updateConfig(vscode, null, 'files.exclude', {});
43+
updateConfig(vscode, undefined, 'files.exclude', {});
4444

4545
const excludedPaths = Options.getExcludedPaths(vscode);
4646
expect(excludedPaths).to.be.empty;
4747
});
4848

4949
test('Verify return excluded paths when files.exclude populated', () => {
5050
const vscode = getVSCodeWithConfig();
51-
updateConfig(vscode, null, 'files.exclude', { "**/node_modules": true, "**/assets": false });
51+
updateConfig(vscode, undefined, 'files.exclude', { "**/node_modules": true, "**/assets": false });
5252

5353
const excludedPaths = Options.getExcludedPaths(vscode);
5454
expect(excludedPaths).to.equalTo(["**/node_modules"]);
5555
});
5656

5757
test('Verify return no excluded paths when files.exclude and search.exclude empty', () => {
5858
const vscode = getVSCodeWithConfig();
59-
updateConfig(vscode, null, 'files.exclude', {});
60-
updateConfig(vscode, null, 'search.exclude', {});
59+
updateConfig(vscode, undefined, 'files.exclude', {});
60+
updateConfig(vscode, undefined, 'search.exclude', {});
6161

6262
const excludedPaths = Options.getExcludedPaths(vscode, true);
6363
expect(excludedPaths).to.be.empty;
6464
});
6565

6666
test('Verify return excluded paths when files.exclude and search.exclude populated', () => {
6767
const vscode = getVSCodeWithConfig();
68-
updateConfig(vscode, null, 'files.exclude', { "/Library": true });
69-
updateConfig(vscode, null, 'search.exclude', { "**/node_modules": true, "**/assets": false });
68+
updateConfig(vscode, undefined, 'files.exclude', { "/Library": true });
69+
updateConfig(vscode, undefined, 'search.exclude', { "**/node_modules": true, "**/assets": false });
7070

7171
const excludedPaths = Options.getExcludedPaths(vscode, true);
7272
expect(excludedPaths).to.be.equalTo(["/Library", "**/node_modules"]);

test/unitTests/testAssets/Fakes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export function getVSCodeWithConfig() {
187187
const _csharpConfig = getWorkspaceConfiguration();
188188
const _razorConfig = getWorkspaceConfiguration();
189189

190-
vscode.workspace.getConfiguration = (section?, resource?) => {
190+
vscode.workspace.getConfiguration = (section, resource) => {
191191
if (section === undefined) {
192192
return _vscodeConfig;
193193
} else if (section === 'omnisharp') {
@@ -204,7 +204,7 @@ export function getVSCodeWithConfig() {
204204
return vscode;
205205
}
206206

207-
export function updateConfig(vscode: vscode.vscode, section: string, config: string, value: any) {
208-
let workspaceConfig = vscode.workspace.getConfiguration(section);
207+
export function updateConfig(vscode: vscode.vscode, section: string | undefined, config: string, value: any) {
208+
const workspaceConfig = vscode.workspace.getConfiguration(section);
209209
workspaceConfig.update(config, value);
210210
}

0 commit comments

Comments
 (0)