mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: use async and wait for adding schemas
This commit is contained in:
@@ -24,13 +24,13 @@ export class MinimalConnectorSpec {
|
|||||||
private static connector: MinimalConnector;
|
private static connector: MinimalConnector;
|
||||||
private static validator: Validator;
|
private static validator: Validator;
|
||||||
|
|
||||||
static before() {
|
static async before() {
|
||||||
this.validator = new Validator();
|
this.validator = new Validator();
|
||||||
|
await this.validator.addSchemas('./node_modules/@openstapps/core/lib/schema');
|
||||||
this.connector = new MinimalConnector();
|
this.connector = new MinimalConnector();
|
||||||
}
|
}
|
||||||
|
|
||||||
static validateThings(things: SCMessage[]) {
|
static validateThings(things: SCMessage[]) {
|
||||||
this.validator.addSchemas('./node_modules/@openstapps/core/lib/schema').then(() => {
|
|
||||||
things.forEach((thing: SCMessage) => {
|
things.forEach((thing: SCMessage) => {
|
||||||
// validate thing
|
// validate thing
|
||||||
expect(MinimalConnectorSpec.validator.validate(thing,"SCMessage").errors).to.have.lengthOf(0, JSON.stringify({
|
expect(MinimalConnectorSpec.validator.validate(thing,"SCMessage").errors).to.have.lengthOf(0, JSON.stringify({
|
||||||
@@ -38,7 +38,6 @@ export class MinimalConnectorSpec {
|
|||||||
thing: thing,
|
thing: thing,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test
|
@test
|
||||||
|
|||||||
Reference in New Issue
Block a user