Skip to content

Commit

Permalink
update tests to match new error specs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 12, 2024
1 parent 75ad021 commit e4e23b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/test/e2e/steps/sign-in.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Sign-in E2E Tests', () => {
.send({ email: '[email protected]', password: '12345567' });

expect(response.status).toBe(401);
expect(response.body.message).toEqual('Invalid credentials');
expect(response.body.errors[0].title).toEqual('Invalid credentials');
});

it('should return 401 when user tries to sign in with an incorrect password', async () => {
Expand All @@ -39,7 +39,7 @@ describe('Sign-in E2E Tests', () => {
.send({ email: user.email, password: 'wrongpassword' });

expect(response.status).toBe(401);
expect(response.body.message).toEqual('Invalid credentials');
expect(response.body.errors[0].title).toEqual('Invalid credentials');
});

it('should return 200 and an access token when user successfully signs in', async () => {
Expand Down
4 changes: 1 addition & 3 deletions api/test/integration/auth/create-user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { MockEmailService } from '../../utils/mocks/mock-email.service';
import { IEmailServiceToken } from '@api/modules/notifications/email/email-service.interface';
import { ROLES } from '@shared/entities/users/roles.enum';

//create-user.feature

describe('Create Users', () => {
let testManager: TestManager;
let testUser: User;
Expand Down Expand Up @@ -68,7 +66,7 @@ describe('Create Users', () => {
// Then the user should receive a 409 status code
expect(response.status).toBe(HttpStatus.CONFLICT);
// And the user should receive a message containing "Email already exists"
expect(response.body.message).toBe(
expect(response.body.errors[0].title).toBe(
`Email ${testUser.email} already exists`,
);
});
Expand Down

0 comments on commit e4e23b3

Please sign in to comment.