billing - fix tests to cosume new endpoints
MODIFY
test/api/BillingStripeTestData.ts
test/api/BillingStripeTestData.ts
@@ -305,7 +305,7 @@ export default class StripeIntegrationTestData {
const params = { Status: state, UserID: [userId] };
const paging = TestConstants.DEFAULT_PAGING;
const ordering = [{ field: '-createdOn' }];
- const response = await this.adminUserService.billingApi.readAll(params, paging, ordering, '/client/api/BillingUserInvoices');
+ const response = await this.adminUserService.billingApi.readInvoices(params, paging, ordering);
return response?.data?.result;
}

MODIFY
test/api/BillingTest.ts
test/api/BillingTest.ts
@@ -165,7 +165,7 @@ class TestData {
const paging = TestConstants.DEFAULT_PAGING;
const ordering = [{ field: '-createdOn' }];
- const response = await testData.adminUserService.billingApi.readAll(params, paging, ordering, '/client/api/BillingUserInvoices');
+ const response = await testData.adminUserService.billingApi.readInvoices(params, paging, ordering);
return response?.data?.result;
}
@@ -481,13 +481,13 @@ describe('Billing Service', function() {
});
it('Should list invoices', async () => {
- const response = await testData.userService.billingApi.readAll({}, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING, '/client/api/BillingUserInvoices');
+ const response = await testData.userService.billingApi.readInvoices({}, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING);
expect(response.status).to.be.eq(StatusCodes.OK);
expect(response.data.result.length).to.be.gt(0);
});
xit('Should list filtered invoices', async () => {
- const response = await testData.userService.billingApi.readAll({ Status: BillingInvoiceStatus.OPEN }, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING, '/client/api/BillingUserInvoices');
+ const response = await testData.userService.billingApi.readInvoices({ Status: BillingInvoiceStatus.OPEN }, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING);
expect(response.data.result.length).to.be.gt(0);
for (const invoice of response.data.result) {
expect(invoice.status).to.be.eq(BillingInvoiceStatus.OPEN);
@@ -605,7 +605,7 @@ describe('Billing Service', function() {
testData.tenantContext.getTenant().subdomain,
basicUser
);
- const response = await testData.userService.billingApi.readAll({}, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING, '/client/api/BillingUserInvoices');
+ const response = await testData.userService.billingApi.readInvoices({}, TestConstants.DEFAULT_PAGING, TestConstants.DEFAULT_ORDERING);
expect(response.data.result.length).to.be.eq(2);
});

MODIFY
test/api/client/BillingApi.ts
test/api/client/BillingApi.ts
@@ -44,4 +44,7 @@ export default class BillingApi extends CrudApi {
return await super.update(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_SETTING));
}
+ public async readInvoices(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
+ return super.readAll(params, paging, ordering, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_INVOICES));
+ }
}

billing - fix tests to cosume new endpoints