(core) add tests for site deletion

Summary: This tests site deletion with and without a plan.

Test Plan: adding tests

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D3017
This commit is contained in:
Paul Fitzpatrick
2021-09-13 17:29:35 -04:00
parent 70160fe01c
commit 3e5a292cde
6 changed files with 20 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ export class Doom {
/**
* Deletes a team site.
* - Remove billing (fails if no outstanding balance).
* - Remove billing (fails if there is an outstanding balance).
* - Delete workspaces.
* - Delete org.
*/

View File

@@ -1331,7 +1331,7 @@ export class HomeDBManager extends EventEmitter {
...wsAcls, ...wsGroups, ...docs, ...docAcls, ...docGroups]);
// Delete billing account if this was the last org using it.
const billingAccount = await manager.findOne(BillingAccount, org.billingAccount,
const billingAccount = await manager.findOne(BillingAccount, org.billingAccountId,
{relations: ['orgs']});
if (billingAccount && billingAccount.orgs.length === 0) {
await manager.remove([billingAccount]);