Skip to content

Instantly share code, notes, and snippets.

@robjshaw
Last active January 12, 2016 22:46
Show Gist options
  • Save robjshaw/9871c701dac67b4ac22f to your computer and use it in GitHub Desktop.
Save robjshaw/9871c701dac67b4ac22f to your computer and use it in GitHub Desktop.
// https://davidbeath.com/posts/testing-http-responses-in-nodejs.html
var expect = require('chai').expect;
var request = require('request');
var param1 = xxxxxxxx;
var host = 'http://xxxxx';
var BalanceMethod = 'xxxxxxxxxx&'
var responseFormat = '&returnformat=json';
describe('checking api return', function() {
it('check balance', function (done) {
request.get(host + BalanceMethod + 'param1=' + param1 + responseFormat, function (err, res, body){
var obj = JSON.parse(body);
expect(res.statusCode).to.equal(200);
expect(obj.RPBALS.RP2).to.equal(151515151);
done();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment