Skip to content

Commit

Permalink
Updated tests according to new API design
Browse files Browse the repository at this point in the history
  • Loading branch information
igolubic committed Aug 13, 2023
1 parent 31c9ad2 commit 634094b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
11 changes: 2 additions & 9 deletions test/admin/auth.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@ import { ADMIN_EMAIL, ADMIN_PASSWORD, APP_URL } from '../utils/constants';
describe('Auth admin (e2e)', () => {
const app = APP_URL;

it('Login: /api/v1/auth/admin/email/login (POST)', () => {
it('Admin Login: /api/v1/auth/email/login (POST)', () => {
return request(app)
.post('/api/v1/auth/admin/email/login')
.post('/api/v1/auth/email/login')
.send({ email: ADMIN_EMAIL, password: ADMIN_PASSWORD })
.expect(200)
.expect(({ body }) => {
expect(body.token).toBeDefined();
expect(body.user.email).toBeDefined();
});
});

it('Login via user endpoint: /api/v1/auth/email/login (POST)', () => {
return request(app)
.post('/api/v1/auth/email/login')
.send({ email: ADMIN_EMAIL, password: ADMIN_PASSWORD })
.expect(422);
});
});
2 changes: 1 addition & 1 deletion test/admin/users.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Users admin (e2e)', () => {

beforeAll(async () => {
await request(app)
.post('/api/v1/auth/admin/email/login')
.post('/api/v1/auth/email/login')
.send({ email: ADMIN_EMAIL, password: ADMIN_PASSWORD })
.then(({ body }) => {
apiToken = body.token;
Expand Down
14 changes: 0 additions & 14 deletions test/user/auth.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ describe('Auth user (e2e)', () => {
});
});

it('Login via admin endpoint: /api/v1/auth/admin/email/login (POST)', () => {
return request(app)
.post('/api/v1/auth/admin/email/login')
.send({ email: TESTER_EMAIL, password: TESTER_PASSWORD })
.expect(422);
});

it('Login via admin endpoint with extra spaced: /api/v1/auth/admin/email/login (POST)', () => {
return request(app)
.post('/api/v1/auth/admin/email/login')
.send({ email: TESTER_EMAIL + ' ', password: TESTER_PASSWORD })
.expect(422);
});

it('Do not allow register user with exists email: /api/v1/auth/email/register (POST)', () => {
return request(app)
.post('/api/v1/auth/email/register')
Expand Down

0 comments on commit 634094b

Please sign in to comment.