billing - test stability - clear test data
MODIFY
test/api/BillingStripeTestData.ts
test/api/BillingStripeTestData.ts
@@ -63,15 +63,17 @@ export default class StripeIntegrationTestData {
this.dynamicUser = await UserStorage.getUser(this.getTenantID(), userData.id);
}
- public async forceBillingSettings(immediateBilling: boolean): Promise<void> {
+ public async forceBillingSettings(immediateBilling: boolean, forceUser = true): Promise<void> {
// The tests requires some settings to be forced
this.billingImpl = await this.setBillingSystemValidCredentials(immediateBilling);
+ if (forceUser) {
this.billingUser = await this.billingImpl.getUser(this.dynamicUser);
if (!this.billingUser && !FeatureToggles.isFeatureActive(Feature.BILLING_SYNC_USER)) {
this.billingUser = await this.billingImpl.forceSynchronizeUser(this.dynamicUser);
}
assert(this.billingUser, 'Billing user should not be null');
}
+ }
public async setBillingSystemValidCredentials(immediateBilling: boolean) : Promise<StripeBillingIntegration> {
const billingSettings = this.getLocalSettings(immediateBilling);

MODIFY
test/api/BillingTestDataCleanupTest.ts
test/api/BillingTestDataCleanupTest.ts
@@ -21,7 +21,7 @@ describe('Billing Test Data Cleanup', function() {
global.database = new MongoDBStorage(config.get('storage'));
await global.database.start();
await testData.initialize();
- await testData.forceBillingSettings(true);
+ await testData.forceBillingSettings(true, false /* forceUser=false */);
});
after(async () => {

billing - test stability - clear test data