feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -0,0 +1,74 @@
import * as request from 'supertest';
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
describe('Pdf Templates (e2e)', () => {
it('/pdf-templates (POST)', () => {
return request(app.getHttpServer())
.post('/pdf-templates')
.set('organization-id', orgainzationId)
.set('Authorization', AuthorizationHeader)
.send({
template_name: 'Standard',
resource: 'SaleInvoice',
attributes: {},
})
.expect(201);
});
it('/pdf-templates (DELETE)', async () => {
const response = await request(app.getHttpServer())
.post('/pdf-templates')
.set('Authorization', AuthorizationHeader)
.set('organization-id', orgainzationId)
.send({
template_name: 'Standard',
resource: 'SaleInvoice',
attributes: {},
});
const pdfTemplateId = response.body.id;
return request(app.getHttpServer())
.delete(`/pdf-templates/${pdfTemplateId}`)
.set('organization-id', orgainzationId)
.set('Authorization', AuthorizationHeader)
.expect(200);
});
it('/pdf-templates/:id (GET)', async () => {
const response = await request(app.getHttpServer())
.post('/pdf-templates')
.set('Authorization', AuthorizationHeader)
.set('organization-id', orgainzationId)
.send({
template_name: 'Standard',
resource: 'SaleInvoice',
attributes: {},
});
const pdfTemplateId = response.body.id;
return request(app.getHttpServer())
.get(`/pdf-templates/${pdfTemplateId}`)
.set('Authorization', AuthorizationHeader)
.set('organization-id', orgainzationId)
.expect(200);
});
it('/pdf-templates/:id/assign-default (POST)', async () => {
const response = await request(app.getHttpServer())
.post('/pdf-templates')
.set('Authorization', AuthorizationHeader)
.set('organization-id', orgainzationId)
.send({
template_name: 'Standard',
resource: 'SaleInvoice',
attributes: {},
});
const pdfTemplateId = response.body.id;
return request(app.getHttpServer())
.put(`/pdf-templates/${pdfTemplateId}/assign-default`)
.set('Authorization', AuthorizationHeader)
.set('organization-id', orgainzationId)
.expect(200);
});
});