From 452147c308120179bd1f4e82d7219f0648df42a2 Mon Sep 17 00:00:00 2001 From: adrinr Date: Tue, 7 Feb 2023 12:45:41 +0000 Subject: [PATCH] Cleanup tests --- .../src/api/routes/public/tests/utils.ts | 4 +--- .../src/tests/utilities/TestConfiguration.ts | 18 +++++------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/packages/server/src/api/routes/public/tests/utils.ts b/packages/server/src/api/routes/public/tests/utils.ts index d861fa3660..755e2d659f 100644 --- a/packages/server/src/api/routes/public/tests/utils.ts +++ b/packages/server/src/api/routes/public/tests/utils.ts @@ -34,9 +34,7 @@ export function generateMakeRequest( ? endpoint : checkSlashesInUrl(`/api/public/v1/${endpoint}`) - const req = request[method](url).set( - config.defaultHeaders(extraHeaders, isInternal) - ) + const req = request[method](url).set(config.defaultHeaders(extraHeaders)) if (body) { req.send(body) } diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index 7b5673a457..5c45f89a2b 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -169,17 +169,16 @@ class TestConfiguration { return this.createApp(appName) } - async end() { + end() { if (!this) { return } - if (this.allApps) { - cleanup(this.allApps.map(app => app.appId)) - } - if (this.server) { this.server.close() } + if (this.allApps) { + cleanup(this.allApps.map(app => app.appId)) + } } // MODES @@ -346,7 +345,7 @@ class TestConfiguration { }) } - defaultHeaders(extras = {}, isInternal: boolean = false) { + defaultHeaders(extras = {}) { const tenantId = this.getTenantId() const authObj: AuthToken = { userId: this.defaultUserValues.globalUserId, @@ -369,13 +368,6 @@ class TestConfiguration { ...extras, } - if (!isInternal) { - headers.Cookie = [ - `${constants.Cookie.Auth}=${authToken}`, - `${constants.Cookie.CurrentApp}=${appToken}`, - ] - } - if (this.appId) { headers[constants.Header.APP_ID] = this.appId }