Created
April 4, 2013 15:33
-
-
Save jedwood/5311429 to your computer and use it in GitHub Desktop.
API Testing Example - Part 2
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
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