mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: update the usage of the validator tool
This commit is contained in:
@@ -26,17 +26,18 @@ export class MinimalConnectorSpec {
|
||||
|
||||
static before() {
|
||||
this.validator = new Validator();
|
||||
this.validator.addSchemas('./node_modules/@openstapps/core/lib/schema');
|
||||
this.connector = new MinimalConnector();
|
||||
}
|
||||
|
||||
static validateThings(things: SCMessage[]) {
|
||||
things.forEach((thing: SCMessage) => {
|
||||
// validate thing
|
||||
expect(MinimalConnectorSpec.validator.validateThing(thing).errors).to.have.lengthOf(0, JSON.stringify({
|
||||
errors: MinimalConnectorSpec.validator.validateThing(thing).errors,
|
||||
thing: thing,
|
||||
}));
|
||||
this.validator.addSchemas('./node_modules/@openstapps/core/lib/schema').then(() => {
|
||||
things.forEach((thing: SCMessage) => {
|
||||
// validate thing
|
||||
expect(MinimalConnectorSpec.validator.validate(thing,"SCMessage").errors).to.have.lengthOf(0, JSON.stringify({
|
||||
errors: MinimalConnectorSpec.validator.validate(thing,"SCMessage").errors,
|
||||
thing: thing,
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user