This repository was archived by the owner on Jul 31, 2018. It is now read-only.
This repository was archived by the owner on Jul 31, 2018. It is now read-only.
before hook inside describe is not load #4
Open
Description
When I use the before block inside the describe block the code inside the before block isn't called but if I put the before block outside of the describe block it is called normally. Is this the normal behaviour?
My script:
eval(globals.postmanBDD);
var schema = {"type":"array","minItems":3,"items":{"type":"object","properties":{"id":{"type":"integer"},"action_code":{"type":["string","null"]},"source":{"type":"string"},"event_extra_info":{"type":"object","properties":{"tag":{"type":"string"}}},"created_at":{"type":"string"}},"required":["id","action_code","source","event_extra_info","created_at"],"additionalProperties":false}};
describe('Approved Calculators API', function(){
before('load schema', function(){
// For now the schema will be maintened on the script too
console.log("schema:", globals.schema);
if(globals.schema !== null && globals.schema !== undefined) {
schema = JSON.parse(globals.schema);
}
});
it('should return a valid JSON response', function(){
expect(response).to.be.json;
// expect(response.body).to.not.be.empty;
expect(response.body).to.have.schema(schema);
});
it('should return 200 as status code', function(){
expect(response).to.have.status(200);
});
it('should not take more than 200 miliseconds to load', function(){
expect(response.time).to.be.at.most(200);
});
after('clean', function(){
postman.clearGlobalVariable("schema");
});
});