Skip to content

Commit

Permalink
Added Unit test and fixed spelling errors. Unit test is Failing
Browse files Browse the repository at this point in the history
  • Loading branch information
CEbbinghaus committed Nov 16, 2021
1 parent 423f89b commit 08b0de2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ export class Configuration extends BaseConfiguration {
const overrides: [string, string[]][] = [];
for (const key of keys) {
if (OVERRIDE_PROPERTY_PATTERN.test(key)) {
const overrideIdentifiesr = overrideIdentifierFromKey(key);
const overrideIdentifiers = overrideIdentifierFromKey(key);

for (let overrideIdentifier of overrideIdentifiesr) {
for (let overrideIdentifier of overrideIdentifiers) {
overrides.push([overrideIdentifier, compare(this.getAllKeysForOverrideIdentifier(overrideIdentifier), other.getAllKeysForOverrideIdentifier(overrideIdentifier), overrideIdentifier)]);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ suite('FolderSettingsModelParser', () => {
assert.deepStrictEqual(testObject.configurationModel.overrides, [{ 'contents': expected, 'identifiers': ['json'], 'keys': ['FolderSettingsModelParser.resource', 'FolderSettingsModelParser.resourceLanguage'] }]);
});

test('parse multiple resource languages settings override', () => {
const testObject = new ConfigurationModelParser('settings');

testObject.parse(JSON.stringify({ '[json, javascript]': { 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.resourceLanguage': 'resourceLanguage' }, '[json]': { 'FolderSettingsModelParser.resourceLanguage': 'overrideResourceLanguage' } }), { scopes: [ConfigurationScope.RESOURCE, ConfigurationScope.LANGUAGE_OVERRIDABLE] });

const expected_json = Object.create(null);
expected_json['FolderSettingsModelParser'] = Object.create(null);
expected_json['FolderSettingsModelParser']['resource'] = 'resource';
expected_json['FolderSettingsModelParser']['resourceLanguage'] = 'overrideResourceLanguage';

const expected_javascript = Object.create(null);
expected_javascript['FolderSettingsModelParser'] = Object.create(null);
expected_javascript['FolderSettingsModelParser']['resource'] = 'resource';
expected_javascript['FolderSettingsModelParser']['resourceLanguage'] = 'resourceLanguage';

assert.deepStrictEqual(testObject.configurationModel.overrides, [{ 'contents': expected_json, 'identifiers': ['json'], 'keys': ['FolderSettingsModelParser.resource', 'FolderSettingsModelParser.resourceLanguage'] }, { 'contents': expected_javascript, 'identifiers': ['javascript'], 'keys': ['FolderSettingsModelParser.resource', 'FolderSettingsModelParser.resourceLanguage'] }]);
});

test('reparse folder settings excludes application and machine setting', () => {
const parseOptions: ConfigurationParseOptions = { scopes: [ConfigurationScope.RESOURCE, ConfigurationScope.WINDOW] };
const testObject = new ConfigurationModelParser('settings');
Expand Down

0 comments on commit 08b0de2

Please sign in to comment.