mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
refactor(nestjs): auth module
This commit is contained in:
58
packages/server-nest/test/auth.e2e-spec.ts
Normal file
58
packages/server-nest/test/auth.e2e-spec.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app } from './init-app-test';
|
||||
|
||||
describe('Authentication (e2e)', () => {
|
||||
beforeAll(async () => {});
|
||||
|
||||
it('should signup success', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/auth/signup')
|
||||
.send({
|
||||
firstName: faker.person.firstName(),
|
||||
lastName: faker.person.lastName(),
|
||||
email: faker.internet.email(),
|
||||
password: '123123123',
|
||||
})
|
||||
.expect(201);
|
||||
});
|
||||
|
||||
it('should signin success', () => {
|
||||
const signupBody = {
|
||||
firstName: faker.person.firstName(),
|
||||
lastName: faker.person.lastName(),
|
||||
email: faker.internet.email(),
|
||||
password: '123123123',
|
||||
};
|
||||
const response = request(app.getHttpServer())
|
||||
.post('/auth/signup')
|
||||
.send(signupBody);
|
||||
|
||||
request(app.getHttpServer())
|
||||
.post('/auth/signin')
|
||||
.send({
|
||||
email: signupBody.email,
|
||||
password: signupBody.password,
|
||||
})
|
||||
.expect(201);
|
||||
});
|
||||
|
||||
it('should send reset password success', () => {
|
||||
const signupBody = {
|
||||
firstName: faker.person.firstName(),
|
||||
lastName: faker.person.lastName(),
|
||||
email: faker.internet.email(),
|
||||
password: '123123123',
|
||||
};
|
||||
const signupResponse = request(app.getHttpServer())
|
||||
.post('/auth/signup')
|
||||
.send(signupBody);
|
||||
|
||||
request(app.getHttpServer())
|
||||
.post('/auth/send_reset_password')
|
||||
.send({
|
||||
email: signupBody.email,
|
||||
})
|
||||
.expect(201);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user