mercredi 2 mars 2016

How to check promise value and property updated in promise but not returned with chai-as-promised

I have a promise which checks if I'm authorized or not (returning true or false). Within that promise, when authorization is false, I'm also adding the 403 statusCode to the response object that I pass as a parameter. I'm testing the result of my promise with chai-as-promised but I didn't manage to find a way to also test the status code of the response after the promise is resolved.

var result = authorizePromise(request, response); return expect(result).to.eventually.equal(false).and(response.statusCode.should.be(403));

Aucun commentaire:

Enregistrer un commentaire