forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigSettings.test.ts
More file actions
43 lines (37 loc) · 1.71 KB
/
configSettings.test.ts
File metadata and controls
43 lines (37 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Note: This example test is leveraging the Mocha test framework.
// Please refer to their documentation on https://mochajs.org/ for help.
//
// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
import * as path from 'path';
import { initialize, IS_MULTI_ROOT_TEST, IS_TRAVIS } from './../initialize';
import { PythonSettings } from '../../client/common/configSettings';
import { SystemVariables } from '../../client/common/systemVariables';
import { rootWorkspaceUri } from '../common';
const workspaceRoot = path.join(__dirname, '..', '..', '..', 'src', 'test');
// Defines a Mocha test suite to group tests of similar kind together
suite('Configuration Settings', () => {
setup(() => initialize());
if (!IS_MULTI_ROOT_TEST) {
test('Check Values', done => {
const systemVariables: SystemVariables = new SystemVariables(workspaceRoot);
const pythonConfig = vscode.workspace.getConfiguration('python');
const pythonSettings = PythonSettings.getInstance(vscode.Uri.file(workspaceRoot));
Object.keys(pythonSettings).forEach(key => {
let settingValue = pythonConfig.get(key, 'Not a config');
if (settingValue === 'Not a config') {
return;
}
if (settingValue) {
settingValue = systemVariables.resolve(settingValue);
}
assert.deepEqual(settingValue, (pythonSettings as any)[key], `Setting ${key} not the same`);
});
done();
});
}
});