Skip to content

Instantly share code, notes, and snippets.

@maxparm
Created January 29, 2013 01:57
Show Gist options
  • Save maxparm/4661016 to your computer and use it in GitHub Desktop.
Save maxparm/4661016 to your computer and use it in GitHub Desktop.
Rest API unit testing with Mocha and Request.
{
"name": "rest-api-unit-testing",
"version": "0.0.1",
"dependencies": {
"mocha": "1.8.1",
"request": "2.12.0"
}
}
/*global it, describe,*/
var request = require('request'),
assert = require('assert');
describe('API CALL UNIT TESTING', function () {
// GET /properties
describe('GET /api', function () {
it("should respond with status 200", function (done) {
request('http://localhost/api', function (err, resp) {
assert.equal(resp.statusCode, 200);
done();
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment