From da8f7eff6ce4f7e94be4f0e12d01ba868bdc2bc7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 17 Jan 2023 10:28:51 +0000 Subject: [PATCH] Delete apps on end --- .../src/tests/utilities/TestConfiguration.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index fe463fea36..5753538eb7 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -137,21 +137,28 @@ class TestConfiguration { return this.createApp(appName) } - end() { + async end() { if (!this) { return } - if (this.server) { - this.server.close() - } if (this.allApps) { cleanup(this.allApps.map(app => app.appId)) + + await this._req( + null, + { appId: this.prodApp.appId }, + controllers.app.destroy + ) + } + + if (this.server) { + this.server.close() } } // UTILS - async _req(body: any, params: any, controlFunc: any) { + _req(body: any, params: any, controlFunc: any) { // create a fake request ctx const request: any = {} const appId = this.appId