stripe - utbilling - test download invoice PDF document
MODIFY
test/api/BillingStripeIntegrationTest.ts
test/api/BillingStripeIntegrationTest.ts
+import chai, { expect } from 'chai';
+
+import { BillingInvoiceStatus } from '../../src/types/Billing';
import MongoDBStorage from '../../src/storage/mongodb/MongoDBStorage';
import StripeIntegrationTestData from './BillingStripeTestData';
-import chai from 'chai';
+import TestConstants from './client/utils/TestConstants';
import chaiSubset from 'chai-subset';
import config from '../config';
import global from '../../src/types/GlobalType';
@@ -42,6 +45,12 @@ describe('Billing Stripe Service', function() {
await testData.checkBusinessProcessBillToPay();
});
+ it('Should download invoice as PDF', async () => {
+ const response = await testData.adminUserService.billingApi.readAll({ Status: BillingInvoiceStatus.PAID }, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING, '/client/api/BillingUserInvoices');
+ expect(response.data.result.length).to.be.gt(0);
+ const downloadResponse = await testData.adminUserService.billingApi.downloadInvoiceDocument({ ID: response.data.result[0].id });
+ expect(downloadResponse.headers['content-type']).to.be.eq('application/pdf');
+ });
});
describe('immediate billing ON', () => {

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
@@ -409,13 +409,6 @@ describe('Billing Service', function() {
expect(response.data.result.length).to.be.eq(2);
});
- xit('Should download invoice as PDF', async () => {
- const response = await testData.userService.billingApi.readAll({ Status: BillingInvoiceStatus.OPEN }, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING, '/client/api/BillingUserInvoices');
- expect(response.data.result.length).to.be.gt(0);
- const downloadResponse = await testData.userService.billingApi.downloadInvoiceDocument({ ID: response.data.result[0].id });
- expect(downloadResponse.headers['content-type']).to.be.eq('application/pdf');
- });
-
it('should create an invoice after a transaction', async () => {
const adminUser = testData.tenantContext.getUserContext(ContextDefinition.USER_CONTEXTS.DEFAULT_ADMIN);
const basicUser = testData.tenantContext.getUserContext(ContextDefinition.USER_CONTEXTS.BASIC_USER);

stripe - utbilling - test download invoice PDF document