mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: e2e test cases
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app } from './init-app-test';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
|
||||
const makeExpenseRequest = () => ({
|
||||
exchangeRate: 1,
|
||||
@@ -11,7 +11,7 @@ const makeExpenseRequest = () => ({
|
||||
paymentDate: faker.date.recent(),
|
||||
categories: [
|
||||
{
|
||||
expenseAccountId: 1045,
|
||||
expenseAccountId: 1021,
|
||||
amount: faker.number.float({ min: 10, max: 1000, precision: 0.01 }),
|
||||
description: faker.lorem.sentence(),
|
||||
},
|
||||
@@ -23,7 +23,7 @@ describe('Expenses (e2e)', () => {
|
||||
it('/expenses (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeExpenseRequest())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -31,14 +31,14 @@ describe('Expenses (e2e)', () => {
|
||||
it('/expenses/:id (PUT)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeExpenseRequest());
|
||||
|
||||
const expenseId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/expenses/${expenseId}`)
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeExpenseRequest())
|
||||
.expect(200);
|
||||
});
|
||||
@@ -46,28 +46,28 @@ describe('Expenses (e2e)', () => {
|
||||
it('/expenses/:id (GET)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeExpenseRequest());
|
||||
|
||||
const expenseId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/expenses/${expenseId}`)
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/expenses/:id (DELETE)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeExpenseRequest());
|
||||
|
||||
const expenseId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/expenses/${expenseId}`)
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user