refactor: e2e test cases

This commit is contained in:
Ahmed Bouhuolia
2025-01-15 17:02:42 +02:00
parent 271c46ea3b
commit 108d286f62
14 changed files with 362 additions and 115 deletions

View File

@@ -129,4 +129,37 @@ describe('Payment Received (e2e)', () => {
.set('organization-id', orgainzationId)
.expect(200);
});
it('/payments-received/:id/mail (POST)', async () => {
const response = await request(app.getHttpServer())
.post('/payments-received')
.set('organization-id', orgainzationId)
.send(requestPaymentReceivedBody(invoice.id));
const paymentReceivedId = response.body.id;
return request(app.getHttpServer())
.post(`/payments-received/${paymentReceivedId}/mail`)
.set('organization-id', orgainzationId)
.send({
subject: 'Email subject from here',
to: 'a.bouhuolia@gmail.com',
body: 'asfdasdf',
})
.expect(200);
});
it('/payments-received/:id/mail (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/payments-received')
.set('organization-id', orgainzationId)
.send(requestPaymentReceivedBody(invoice.id));
const paymentReceivedId = response.body.id;
return request(app.getHttpServer())
.get(`/payments-received/${paymentReceivedId}/mail`)
.set('organization-id', orgainzationId)
.expect(200);
});
});

View File

@@ -119,4 +119,41 @@ describe('Sale Estimates (e2e)', () => {
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-estimates (GET)', async () => {
return request(app.getHttpServer())
.get('/sale-estimates')
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-estimates/:id/mail (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-estimates')
.set('organization-id', orgainzationId)
.send(makeEstimateRequest());
return request(app.getHttpServer())
.get(`/sale-estimates/${response.body.id}/mail`)
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-estimates/:id/mail (POST)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-estimates')
.set('organization-id', orgainzationId)
.send(makeEstimateRequest());
return request(app.getHttpServer())
.post(`/sale-estimates/${response.body.id}/mail`)
.set('organization-id', orgainzationId)
.send({
subject: 'Email subject from here',
to: 'a.bouhuolia@gmail.com',
body: 'asfdasdf',
attachInvoice: false,
})
.expect(200);
});
});

View File

@@ -84,6 +84,18 @@ describe('Sale Invoices (e2e)', () => {
.expect(200);
});
it('/sale-invoices (GET)', async () => {
await request(app.getHttpServer())
.post('/sale-invoices')
.set('organization-id', orgainzationId)
.send(requestSaleInvoiceBody());
return request(app.getHttpServer())
.get('/sale-invoices')
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-invoices/:id (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-invoices')
@@ -172,4 +184,34 @@ describe('Sale Invoices (e2e)', () => {
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-invoices/:id/mail-state (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-invoices')
.set('organization-id', orgainzationId)
.send(requestSaleInvoiceBody());
return request(app.getHttpServer())
.get(`/sale-invoices/${response.body.id}/mail-state`)
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-invoices/:id/mail (POST)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-invoices')
.set('organization-id', orgainzationId)
.send(requestSaleInvoiceBody());
return request(app.getHttpServer())
.put(`/sale-invoices/${response.body.id}/mail`)
.set('organization-id', orgainzationId)
.send({
subject: 'Email subject from here',
to: 'a.bouhuolia@gmail.com',
body: 'asfdasdf',
attachInvoice: false,
})
.expect(200);
});
});

View File

@@ -90,6 +90,13 @@ describe('Sale Receipts (e2e)', () => {
.expect(200);
});
it('/sale-receipts (GET)', async () => {
return request(app.getHttpServer())
.get('/sale-receipts')
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-receipts/:id (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-receipts')
@@ -103,4 +110,16 @@ describe('Sale Receipts (e2e)', () => {
.set('organization-id', orgainzationId)
.expect(200);
});
it('/sale-receipts/:id/mail (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/sale-receipts')
.set('organization-id', orgainzationId)
.send(makeReceiptRequest());
return request(app.getHttpServer())
.get(`/sale-receipts/${response.body.id}/mail`)
.set('organization-id', orgainzationId)
.expect(200);
});
});