mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
59
packages/server/test/auth.e2e-spec.ts
Normal file
59
packages/server/test/auth.e2e-spec.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
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