-
Notifications
You must be signed in to change notification settings - Fork 679
/
OptionProvider.test.ts
39 lines (33 loc) · 1.61 KB
/
OptionProvider.test.ts
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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { should, expect } from 'chai';
import { getVSCodeWithConfig, updateConfig } from "../testAssets/Fakes";
import { vscode } from "../../../src/vscodeAdapter";
import OptionProvider from '../../../src/observers/OptionProvider';
import { Subject } from 'rxjs/Subject';
import { Options } from '../../../src/omnisharp/options';
suite('OptionProvider', () => {
suiteSetup(() => should());
let vscode: vscode;
let optionProvider: OptionProvider;
let optionObservable: Subject<Options>;
setup(() => {
vscode = getVSCodeWithConfig();
optionObservable = new Subject<Options>();
optionProvider = new OptionProvider(optionObservable);
});
test("Throws exception when no options are pushed", () => {
expect(optionProvider.GetLatestOptions).to.throw();
});
test("Gives the latest options when options are changed", () => {
let changingConfig = "omnisharp";
updateConfig(vscode, changingConfig, 'path', "somePath");
optionObservable.next(Options.Read(vscode));
updateConfig(vscode, changingConfig, 'path', "anotherPath");
optionObservable.next(Options.Read(vscode));
let options = optionProvider.GetLatestOptions();
expect(options.path).to.be.equal("anotherPath");
});
});