Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoow committed Nov 22, 2019
1 parent cace2a9 commit 7709313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/unit/authenticators/devise-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe('DeviseAuthenticator', () => {

try {
await authenticator.authenticate('email@address.com', 'password');
expect(false).to.be.true;
} catch (error) {
expect(error).to.eql('Check that server response includes token and email');
}
Expand All @@ -87,6 +88,7 @@ describe('DeviseAuthenticator', () => {

try {
await authenticator.authenticate('email@address.com', 'password');
expect(false).to.be.true;
} catch (error) {
expect(error).to.eql('Check that server response includes token and email');
}
Expand All @@ -102,6 +104,7 @@ describe('DeviseAuthenticator', () => {
it('rejects with the response', async function() {
try {
await authenticator.authenticate('username', 'password');
expect(false).to.be.true;
} catch (response) {
expect(response.ok).to.be.false;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/authenticators/oauth2-implicit-grant-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('OAuth2ImplicitGrantAuthenticator', () => {
it('returns a rejecting promise', async function() {
try {
await authenticator.restore();
expect(false).to.be.true;
} catch (error) {
expect(error).to.eql('Could not restore session - "access_token" missing.');
}
Expand All @@ -47,6 +48,7 @@ describe('OAuth2ImplicitGrantAuthenticator', () => {
it('rejects with an error', async function() {
try {
await authenticator.authenticate({ foo: 'bar' });
expect(false).to.be.true;
} catch (error) {
expect(error).to.eql('Invalid auth params - "access_token" missing.');
}
Expand All @@ -57,6 +59,7 @@ describe('OAuth2ImplicitGrantAuthenticator', () => {
it('rejects with that error', async function() {
try {
await authenticator.authenticate({ error: 'access_denied' });
expect(false).to.be.true;
} catch (error) {
expect(error).to.eql('access_denied');
}
Expand Down

0 comments on commit 7709313

Please sign in to comment.