mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from master
This commit is contained in:
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as os from 'os';
|
||||
|
||||
@@ -16,7 +14,7 @@ import { testFile } from 'vs/base/test/node/utils';
|
||||
|
||||
suite('Config', () => {
|
||||
|
||||
test('defaults', function () {
|
||||
test('defaults', () => {
|
||||
const id = uuid.generateUuid();
|
||||
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
|
||||
const newDir = path.join(parentDir, 'config', id);
|
||||
@@ -48,9 +46,6 @@ suite('Config', () => {
|
||||
let config = watcher.getConfig();
|
||||
assert.ok(config);
|
||||
assert.equal(config.foo, 'bar');
|
||||
assert.equal(watcher.getValue('foo'), 'bar');
|
||||
assert.equal(watcher.getValue('bar'), void 0);
|
||||
assert.equal(watcher.getValue('bar', 'fallback'), 'fallback');
|
||||
assert.ok(!watcher.hasParseErrors);
|
||||
|
||||
watcher.dispose();
|
||||
@@ -146,20 +141,18 @@ suite('Config', () => {
|
||||
testFile('config', 'config.json').then(res => {
|
||||
fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "bar" }');
|
||||
|
||||
let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile, { changeBufferDelay: 100, onError: console.error });
|
||||
let watcher = new ConfigWatcher<{ foo: string; }>(res.testFile, { changeBufferDelay: 100, onError: console.error, defaultConfig: void 0 });
|
||||
watcher.getConfig(); // ensure we are in sync
|
||||
|
||||
fs.writeFileSync(res.testFile, '// my comment\n{ "foo": "changed" }');
|
||||
|
||||
// still old values because change is not bubbling yet
|
||||
assert.equal(watcher.getConfig().foo, 'bar');
|
||||
assert.equal(watcher.getValue('foo'), 'bar');
|
||||
|
||||
// force a load from disk
|
||||
watcher.reload(config => {
|
||||
assert.equal(config.foo, 'changed');
|
||||
assert.equal(watcher.getConfig().foo, 'changed');
|
||||
assert.equal(watcher.getValue('foo'), 'changed');
|
||||
|
||||
watcher.dispose();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user