Skip to content

Instantly share code, notes, and snippets.

@brianflurry
Created October 2, 2012 17:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianflurry/3821607 to your computer and use it in GitHub Desktop.
Save brianflurry/3821607 to your computer and use it in GitHub Desktop.
Hello World Mocha regression test
// init the test client
var client = restify.createJsonClient({
version: '*',
url: 'http://127.0.0.1:8080'
});
describe('service: hello', function() {
// Test #1
describe('200 response check', function() {
it('should get a 200 response', function(done) {
client.get('/hello/world', function(err, req, res, data) {
if (err) {
throw new Error(err);
}
else {
if (data.code != 200) {
throw new Error('invalid response from /hello/world');
}
done();
}
});
});
});
// Add more tests as needed...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment