I am complete newbie to JS world. I am trying to write a test case that tests user's actions on a site. I am using request-promise module to test the asyn calls. I could not find any api documentation for request-promise.
How do I get access to status code of the response? Right now it prints undefined. Also, can anyone please confirm, how do we know what promise returns when it is successful, is it a single value that it resolves to or all the parameters that the async function returns. How do we know what are the parameters to function() in request.get(base_url).then(function(response, body)
.
var request = require("request-promise");
var promise = require("bluebird");
//
var base_url = "https://mysignin.com/"
//
describe("My first test", function() {
it("User is on the sign in page", function(done) {
request.get(base_url).then(function(response, body){
// expect(response.statusCode).toBe('GET /200');
console.log("respnse " + response.statusCode);
console.log("Body " + body);
done();
}).catch(function(error) {
done("Oops somthing went wrong!!");
});
});
});