use environment variables in jest run

This commit is contained in:
Martin McKeaveney 2022-09-28 18:31:23 +01:00
parent 20ae838475
commit 943bd54879
3 changed files with 6 additions and 9 deletions

View File

@ -9,8 +9,8 @@
"url": "https://github.com/Budibase/budibase.git"
},
"scripts": {
"test": "jest --runInBand",
"test:watch": "jest --watch",
"test": "env-cmd jest --runInBand",
"test:watch": "env-cmd jest --watch",
"test:debug": "DEBUG=1 jest",
"docker:up": "docker-compose up -d",
"docker:down": "docker-compose down",
@ -53,4 +53,4 @@
"@budibase/backend-core": "^2.0.5",
"node-fetch": "2"
}
}
}

View File

@ -12,7 +12,6 @@ interface ApiOptions {
class InternalAPIClient {
host: string
appId?: string
csrfToken?: string
cookie?: string
constructor(appId?: string) {

View File

@ -11,10 +11,8 @@ export default class AuthApi {
async login(): Promise<[Response, any]> {
const response = await this.api.post(`/global/auth/default/login`, {
body: {
// username: process.env.BB_ADMIN_USER_EMAIL,
// password: process.env.BB_ADMIN_USER_PASSWORD
username: "qa@budibase.com",
password: "budibase"
username: process.env.BB_ADMIN_USER_EMAIL,
password: process.env.BB_ADMIN_USER_PASSWORD
}
})
const cookie = response.headers.get("set-cookie")
@ -23,6 +21,6 @@ export default class AuthApi {
}
async logout(): Promise<any> {
return this.api.post(`/global/auth/default/logout`)
return this.api.post(`/global/auth/logout`)
}
}