refactor: e2e

This commit is contained in:
Ahmed Bouhuolia
2025-01-01 14:39:25 +02:00
parent 8bacf3a001
commit b72f85b394
14 changed files with 227 additions and 137 deletions

View File

@@ -16,10 +16,7 @@ const makeExpenseRequest = () => ({
description: faker.lorem.sentence(),
},
],
// currencyCode: faker.finance.currencyCode(),
// userId: faker.number.int({ min: 1, max: 100 }),
// payeeId: faker.number.int({ min: 1, max: 100 }),
// branchId: faker.number.int({ min: 1, max: 100 }),
branchId: 1,
});
describe('Expenses (e2e)', () => {
@@ -31,6 +28,21 @@ describe('Expenses (e2e)', () => {
.expect(201);
});
it('/expenses/:id (PUT)', async () => {
const response = await request(app.getHttpServer())
.post('/expenses')
.set('organization-id', '4064541lv40nhca')
.send(makeExpenseRequest());
const expenseId = response.body.id;
return request(app.getHttpServer())
.put(`/expenses/${expenseId}`)
.set('organization-id', '4064541lv40nhca')
.send(makeExpenseRequest())
.expect(200);
});
it('/expenses/:id (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/expenses')