Last active
January 12, 2016 22:46
-
-
Save robjshaw/9871c701dac67b4ac22f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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