Skip to content

Commit

Permalink
Merge pull request #45 from openactive/imperative-config-tests
Browse files Browse the repository at this point in the history
Add tests for imperativeConfiguration and validationMode
  • Loading branch information
henryaddison authored Oct 25, 2019
2 parents 0f4d74a + 75df1e7 commit 1af1336
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/models-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,32 @@ describe('models', () => {
}
});
});

describe('imperativeConfiguration', () => {
['requiredFields', 'recommendedFields', 'shallNotInclude'].forEach((fieldRestriction) => {
describe(fieldRestriction, () => {
it('should only contain fields from inSpec', () => {
if (Object.prototype.hasOwnProperty.call(jsonData, 'imperativeConfiguration')) {
for (const config of Object.values(jsonData.imperativeConfiguration)) {
for (const fieldName of config[fieldRestriction]) {
expect(jsonData.inSpec).toContain(fieldName);
}
}
}
});
});
});
});

describe('validationMode', () => {
it('should point to entries in imperativeConfiguration', () => {
if (Object.prototype.hasOwnProperty.call(jsonData, 'validationMode')) {
for (const imperativeConfigurationKey of Object.values(jsonData.validationMode)) {
expect(Object.keys(jsonData.imperativeConfiguration)).toContain(imperativeConfigurationKey);
}
}
});
});
});

describe('namespaces', () => {
Expand Down

0 comments on commit 1af1336

Please sign in to comment.