mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 11:12:52 +00:00
refactor: use async and wait for adding schemas
This commit is contained in:
@@ -24,20 +24,19 @@ export class MinimalConnectorSpec {
|
||||
private static connector: MinimalConnector;
|
||||
private static validator: Validator;
|
||||
|
||||
static before() {
|
||||
static async before() {
|
||||
this.validator = new Validator();
|
||||
await this.validator.addSchemas('./node_modules/@openstapps/core/lib/schema');
|
||||
this.connector = new MinimalConnector();
|
||||
}
|
||||
|
||||
static validateThings(things: SCMessage[]) {
|
||||
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,
|
||||
}));
|
||||
});
|
||||
static validateThings(things: SCMessage[]) {
|
||||
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