mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-12 10:50:31 +00:00
60 lines
1.5 KiB
TypeScript
60 lines
1.5 KiB
TypeScript
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);
|
|
});
|
|
});
|