Cleanup tests

This commit is contained in:
adrinr 2023-02-07 12:45:41 +00:00
parent 2cdc2f3fec
commit 452147c308
2 changed files with 6 additions and 16 deletions

View File

@ -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)
}

View File

@ -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
}