Skip to content
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
@otoniel-isidoro

Description

@otoniel-isidoro

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"); 
   });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions