Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
API Testing Example - Part 1
describe('Authentication', function() {
it('errors if wrong basic auth', function(done) {
api.get('/blog')
.set('x-api-key', '123myapikey')
.auth('incorrect', 'credentials')
.expect(401, done)
});
it('errors if bad x-api-key header', function(done) {
api.get('/blog')
.auth('correct', 'credentials')
.expect(401)
.expect({error:"Bad or missing app identification header"}, done);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.