mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
74
packages/server/test/pdf-templates.e2e-spec.ts
Normal file
74
packages/server/test/pdf-templates.e2e-spec.ts
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user