Skip to content

Commit

Permalink
Add tests for no bearer options or validateFunc provided
Browse files Browse the repository at this point in the history
closes #103
  • Loading branch information
johnbrett committed Oct 11, 2016
1 parent b85b9cc commit cec508c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,27 @@ after((done) => {
done();
});

it('throws when no bearer options provided', (done) => {

try {
server.auth.strategy('no_options', 'bearer-access-token', true);
}
catch (e) {
expect(e.message).to.equal('Missing bearer auth strategy options');
done();
}
});

it('throws when validateFunc is not provided', (done) => {

try {
server.auth.strategy('no_options', 'bearer-access-token', true, { validateFunc: 'string' });
}
catch (e) {
expect(e.details[0].message).to.equal('"validateFunc" must be a Function');
done();
}
});

it('returns 200 and success with correct bearer token header set', (done) => {

Expand Down

0 comments on commit cec508c

Please sign in to comment.