Skip to content

Instantly share code, notes, and snippets.

@khilnani
Forked from jedwood/sample-test-2.js
Last active August 29, 2015 13:57
Show Gist options
  • Save khilnani/9583008 to your computer and use it in GitHub Desktop.
Save khilnani/9583008 to your computer and use it in GitHub Desktop.
var should = require('chai').should(),
supertest = require('supertest'),
api = supertest('http://localhost:5000');
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