Sorry for bugging you with all the questions, but I’m starting to use CommandBox as much as possible now and just trying to find out if there are things I’m doing incorrectly or whether it may be a bug.
I’m writing some integration tests for an API and seeing some errors when I run “testbox run” that I don’t see if I run the same tests in the browser. I’m wondering if it has to do with headers not being present when running tests via console.
I may even be writing these tests incorrectly as this is my first time writing any tests in TestBox and ColdBox. So feel free to tell me I’m doing this completely wrong, but the test passes in the browser so hopefully it’s close.
My spec looks like:
function run(){
describe( “Maintenance Plan”, function(){
beforeEach(function( currentSpec ){
// Setup as a new ColdBox request for this suite, VERY IMPORTANT. ELSE EVERYTHING LOOKS LIKE THE SAME REQUEST.
setup();
});
it( “+lists maintanance plans”, function(){
var event = execute( “api.accounting.MaintenancePlan.list”);
expect( event.getRenderData().contentType ).toBe( “application/json” );
expect( event.getRenderData().data ).toBeTypeOf( “struct” );
expect( event.getRenderData().data ).toHaveKey( “success” );
});
});
}
I don’t typically like to have a lot of expectations but I kept throwing them in when I started seeing the errors.
The issue seems to be that getRenderData() is completely empty but like I said, in the browser all expectations pass.
If this should be posted in the ColdBox group just let me know, but it seemed appropriate to post here since I don’t think it’s a testbox issue.
Thanks,
Ben