refactor: Use unauthorized user describe block for getUser tests
This commit is contained in:
@@ -4,7 +4,8 @@ import createAuthTokenByUserId from '../../helpers/create-auth-token-by-user-id'
|
|||||||
import Crypto from 'crypto';
|
import Crypto from 'crypto';
|
||||||
|
|
||||||
describe('getUser', () => {
|
describe('getUser', () => {
|
||||||
it('should throw not authorized error for an unauthorized user', async () => {
|
describe('with unauthorized user', () => {
|
||||||
|
it('should throw not authorized error', async () => {
|
||||||
const invalidUserId = '123123123';
|
const invalidUserId = '123123123';
|
||||||
|
|
||||||
const query = `
|
const query = `
|
||||||
@@ -25,6 +26,7 @@ describe('getUser', () => {
|
|||||||
expect(response.body.errors).toBeDefined();
|
expect(response.body.errors).toBeDefined();
|
||||||
expect(response.body.errors[0].message).toEqual('Not Authorised!');
|
expect(response.body.errors[0].message).toEqual('Not Authorised!');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('with authorized user', () => {
|
describe('with authorized user', () => {
|
||||||
it('should return user data for a valid user id', async () => {
|
it('should return user data for a valid user id', async () => {
|
||||||
|
Reference in New Issue
Block a user