Skip to content

Commit

Permalink
PR comments resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-vr committed Jan 31, 2019
1 parent ce4a6e8 commit 353e83f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/lib/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as httpMocks from 'node-mocks-http';
import * as httpStatus from 'http-status';
import { UnauthorizedError } from 'tree-house-errors';
import { errors } from '../../src/config/errors.config';
import { roles } from '../../src/config/roles.config';
Expand Down Expand Up @@ -107,10 +108,10 @@ describe('lib/utils', () => {

try {
utils.checkStatus(user);
} catch (err) {
expect(err).toBeInstanceOf(Error);
expect(err.code).toEqual('USER_INACTIVE');
expect(err.message).toEqual('Your account is inactive. Please contact your administrator.');
} catch (error) {
expect(error.status).toEqual(httpStatus.UNAUTHORIZED);
expect(error.code).toEqual(errors.USER_INACTIVE.code);
expect(error.message).toEqual(errors.USER_INACTIVE.message);
}
});

Expand All @@ -136,9 +137,10 @@ describe('lib/utils', () => {

try {
utils.checkStatus(user);
} catch (err) {
expect(err).toBeInstanceOf(Error);
expect(err.message).toEqual('Your account is not confirmed. Please check your inbox for the confirmation link.');
} catch (error) {
expect(error.status).toEqual(httpStatus.UNAUTHORIZED);
expect(error.code).toEqual(errors.USER_UNCONFIRMED.code);
expect(error.message).toEqual(errors.USER_UNCONFIRMED.message);
}
});
});
Expand Down

0 comments on commit 353e83f

Please sign in to comment.