You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 31, 2018. It is now read-only.
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");
});
});
The text was updated successfully, but these errors were encountered:
Good catch. The code is currently written with the expectation that any hooks (e.g. before, after, etc.) will be written before anything else, but there's no reason I can't make it work for this scenario too.
The before hook runs one time, before the very first describe block. So, currently, if you define a before hook after the first describe block, then the hook will never trigger. But I'll change it so that if a describe block has already occurred, then the before hook will just run immediately.
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:
The text was updated successfully, but these errors were encountered: