Skip to content

Commit

Permalink
more tests for exthost configuration, #10583
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 4, 2016
1 parent 3ecfa31 commit 1acd2b5
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions src/vs/workbench/test/node/api/extHostConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,48 @@ suite('ExtHostConfiguration', function () {
return new ExtHostConfiguration(shape, data);
}

test('udate / section to key', function () {
test('has/get', function () {

const all = createExtHostConfiguration({
farboo: {
config0: true,
nested: {
config1: 42,
config2: 'Das Pferd frisst kein Reis.'
},
config4: ''
}
});

const config = all.getConfiguration('farboo');

assert.ok(config.has('config0'));
assert.equal(config.get('config0'), true);
assert.equal(config.get('config4'), '');
assert.equal(config['config0'], true);
assert.equal(config['config4'], '');
assert.throws(() => config['config4'] = 'valuevalue');
assert.ok(config.has('nested.config1'));
assert.equal(config.get('nested.config1'), 42);
assert.ok(config.has('nested.config2'));
assert.equal(config.get('nested.config2'), 'Das Pferd frisst kein Reis.');
});

test('name vs property', function () {
const all = createExtHostConfiguration({
farboo: {
get: 'get-prop'
}
});
const config = all.getConfiguration('farboo');

assert.ok(config.has('get'));
assert.equal(config.get('get'), 'get-prop');
assert.deepEqual(config['get'], config.get);
assert.throws(() => config['get'] = <any>'get-prop');
});

test('udate/section to key', function () {

const shape = new RecordingShape();
const allConfig = createExtHostConfiguration({ foo: { bar: 1, far: 2 } }, shape);
Expand All @@ -47,7 +88,7 @@ suite('ExtHostConfiguration', function () {
assert.equal(shape.lastArgs[1], 'foo.bar');
});

test('update / error-state not OK', function () {
test('update/error-state not OK', function () {

const shape = new class extends MainThreadConfigurationShape {
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): TPromise<any> {
Expand Down

0 comments on commit 1acd2b5

Please sign in to comment.