test: Correct get current user test descriptions

This commit is contained in:
Faruk AYDIN
2023-10-14 20:04:49 +02:00
parent eaa25e412a
commit fb80d5d70d

View File

@@ -6,7 +6,7 @@ import createUser from '../../../test/fixtures/user';
import { IRole, IUser } from '@automatisch/types'; import { IRole, IUser } from '@automatisch/types';
describe('graphQL getCurrentUser query', () => { describe('graphQL getCurrentUser query', () => {
describe('with unauthorized user', () => { describe('with unauthenticated user', () => {
it('should throw not authorized error', async () => { it('should throw not authorized error', async () => {
const invalidUserToken = 'invalid-token'; const invalidUserToken = 'invalid-token';
@@ -30,7 +30,7 @@ describe('graphQL getCurrentUser query', () => {
}); });
}); });
describe('with authorized user', () => { describe('with authenticated user', () => {
let role: IRole, currentUser: IUser, token: string, requestObject: Test; let role: IRole, currentUser: IUser, token: string, requestObject: Test;
beforeEach(async () => { beforeEach(async () => {
@@ -44,9 +44,7 @@ describe('graphQL getCurrentUser query', () => {
}); });
token = createAuthTokenByUserId(currentUser.id); token = createAuthTokenByUserId(currentUser.id);
requestObject = request(app) requestObject = request(app).post('/graphql').set('Authorization', token);
.post('/graphql')
.set('Authorization', token);
}); });
it('should return user data', async () => { it('should return user data', async () => {