Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jedwood
Created April 4, 2013 15:33
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jedwood/5311429 to your computer and use it in GitHub Desktop.
Save jedwood/5311429 to your computer and use it in GitHub Desktop.
API Testing Example - Part 2
describe('/blog', function() {
it('returns blog posts as JSON', function(done) {
api.get('/blog')
.set('x-api-key', '123myapikey')
.auth('correct', 'credentials')
.expect(200)
.expect('Content-Type', /json/)
.end(function(err, res) {
if (err) return done(err);
res.body.should.have.property('posts').and.be.instanceof(Array);
done();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment