refactor: Use unauthorized user describe block for getUser tests

This commit is contained in:
Faruk AYDIN
2023-10-04 12:23:45 +02:00
parent 24c95f4801
commit ffb2f4f5db

View File

@@ -4,7 +4,8 @@ import createAuthTokenByUserId from '../../helpers/create-auth-token-by-user-id'
import Crypto from 'crypto';
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 query = `
@@ -25,6 +26,7 @@ describe('getUser', () => {
expect(response.body.errors).toBeDefined();
expect(response.body.errors[0].message).toEqual('Not Authorised!');
});
});
describe('with authorized user', () => {
it('should return user data for a valid user id', async () => {