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

@@ -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);
});
});