1
0
Fork 0
mirror of synced 2024-09-11 06:56:23 +12:00

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 ? endpoint
: checkSlashesInUrl(`/api/public/v1/${endpoint}`) : checkSlashesInUrl(`/api/public/v1/${endpoint}`)
const req = request[method](url).set( const req = request[method](url).set(config.defaultHeaders(extraHeaders))
config.defaultHeaders(extraHeaders, isInternal)
)
if (body) { if (body) {
req.send(body) req.send(body)
} }

View file

@ -169,17 +169,16 @@ class TestConfiguration {
return this.createApp(appName) return this.createApp(appName)
} }
async end() { end() {
if (!this) { if (!this) {
return return
} }
if (this.allApps) {
cleanup(this.allApps.map(app => app.appId))
}
if (this.server) { if (this.server) {
this.server.close() this.server.close()
} }
if (this.allApps) {
cleanup(this.allApps.map(app => app.appId))
}
} }
// MODES // MODES
@ -346,7 +345,7 @@ class TestConfiguration {
}) })
} }
defaultHeaders(extras = {}, isInternal: boolean = false) { defaultHeaders(extras = {}) {
const tenantId = this.getTenantId() const tenantId = this.getTenantId()
const authObj: AuthToken = { const authObj: AuthToken = {
userId: this.defaultUserValues.globalUserId, userId: this.defaultUserValues.globalUserId,
@ -369,13 +368,6 @@ class TestConfiguration {
...extras, ...extras,
} }
if (!isInternal) {
headers.Cookie = [
`${constants.Cookie.Auth}=${authToken}`,
`${constants.Cookie.CurrentApp}=${appToken}`,
]
}
if (this.appId) { if (this.appId) {
headers[constants.Header.APP_ID] = this.appId headers[constants.Header.APP_ID] = this.appId
} }