|
@@ -4,7 +4,7 @@ import {DataSchemaRegistry} from './data-schema-registry.js';
|
|
|
|
|
|
|
|
describe('DataSchemaRegistry', function () {
|
|
describe('DataSchemaRegistry', function () {
|
|
|
describe('defineSchema', function () {
|
|
describe('defineSchema', function () {
|
|
|
- it('should register the given definition', function () {
|
|
|
|
|
|
|
+ it('should register a given definition', function () {
|
|
|
const S = new DataSchemaRegistry();
|
|
const S = new DataSchemaRegistry();
|
|
|
const schemaDef = {name: 'mySchema', schema: {}};
|
|
const schemaDef = {name: 'mySchema', schema: {}};
|
|
|
S.defineSchema(schemaDef);
|
|
S.defineSchema(schemaDef);
|
|
@@ -32,7 +32,7 @@ describe('DataSchemaRegistry', function () {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('hasSchema', function () {
|
|
describe('hasSchema', function () {
|
|
|
- it('should return true if the given name is registered', function () {
|
|
|
|
|
|
|
+ it('should return true if a given name is registered', function () {
|
|
|
const S = new DataSchemaRegistry();
|
|
const S = new DataSchemaRegistry();
|
|
|
const schemaDef = {name: 'mySchema', schema: {}};
|
|
const schemaDef = {name: 'mySchema', schema: {}};
|
|
|
expect(S.hasSchema(schemaDef.name)).to.be.false;
|
|
expect(S.hasSchema(schemaDef.name)).to.be.false;
|
|
@@ -42,13 +42,13 @@ describe('DataSchemaRegistry', function () {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('getSchema', function () {
|
|
describe('getSchema', function () {
|
|
|
- it('should throw an error if the given name is not registered', function () {
|
|
|
|
|
|
|
+ it('should throw an error if a given name is not registered', function () {
|
|
|
const S = new DataSchemaRegistry();
|
|
const S = new DataSchemaRegistry();
|
|
|
const throwable = () => S.getSchema('mySchema');
|
|
const throwable = () => S.getSchema('mySchema');
|
|
|
expect(throwable).to.throw('Data schema "mySchema" is not found.');
|
|
expect(throwable).to.throw('Data schema "mySchema" is not found.');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should return the schema part of a registered definition for a given name', function () {
|
|
|
|
|
|
|
+ it('should return the schema property of a registered definition', function () {
|
|
|
const S = new DataSchemaRegistry();
|
|
const S = new DataSchemaRegistry();
|
|
|
const schemaDef = {name: 'mySchema', schema: {}};
|
|
const schemaDef = {name: 'mySchema', schema: {}};
|
|
|
S.defineSchema(schemaDef);
|
|
S.defineSchema(schemaDef);
|
|
@@ -58,7 +58,7 @@ describe('DataSchemaRegistry', function () {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('getDefinition', function () {
|
|
describe('getDefinition', function () {
|
|
|
- it('should throw an error if the given name is not registered', function () {
|
|
|
|
|
|
|
+ it('should throw an error if a given name is not registered', function () {
|
|
|
const S = new DataSchemaRegistry();
|
|
const S = new DataSchemaRegistry();
|
|
|
const throwable = () => S.getDefinition('mySchema');
|
|
const throwable = () => S.getDefinition('mySchema');
|
|
|
expect(throwable).to.throw('Schema definition "mySchema" is not found.');
|
|
expect(throwable).to.throw('Schema definition "mySchema" is not found.');
|