Fix tests.
This commit is contained in:
parent
2c3b3d03e1
commit
e0243b495c
|
@ -17,7 +17,6 @@ import {
|
|||
basicWebhook,
|
||||
} from "./structures"
|
||||
import {
|
||||
auth,
|
||||
cache,
|
||||
constants,
|
||||
context,
|
||||
|
@ -227,6 +226,13 @@ class TestConfiguration {
|
|||
}
|
||||
|
||||
return () => {
|
||||
for (const key in newEnvVars) {
|
||||
// @ts-ignore
|
||||
delete env[key]
|
||||
// @ts-ignore
|
||||
delete coreEnv[key]
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(oldEnv)) {
|
||||
env._set(key, value)
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ async function isSqsAvailable() {
|
|||
await nodeFetch(coreEnv.COUCH_DB_SQL_URL, {
|
||||
timeout: 1000,
|
||||
})
|
||||
sqsAvailable = true
|
||||
return true
|
||||
} catch (e) {
|
||||
sqsAvailable = false
|
||||
return false
|
||||
}
|
||||
sqsAvailable = true
|
||||
return true
|
||||
}
|
||||
|
||||
export const fetch = async (ctx: Ctx) => {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { TestConfiguration } from "../../../../tests"
|
||||
|
||||
jest.unmock("node-fetch")
|
||||
|
||||
describe("/api/system/environment", () => {
|
||||
const config = new TestConfiguration()
|
||||
|
||||
|
@ -29,10 +31,10 @@ describe("/api/system/environment", () => {
|
|||
})
|
||||
|
||||
it("returns the expected environment for self hosters", async () => {
|
||||
config.withEnv({ SELF_HOSTED: true }, async () => {
|
||||
await config.withEnv({ SELF_HOSTED: true }, async () => {
|
||||
const env = await config.api.environment.getEnvironment()
|
||||
expect(env.body).toEqual({
|
||||
cloud: true,
|
||||
cloud: false,
|
||||
disableAccountPortal: 0,
|
||||
isDev: false,
|
||||
multiTenancy: true,
|
||||
|
|
|
@ -265,6 +265,13 @@ class TestConfiguration {
|
|||
}
|
||||
|
||||
return () => {
|
||||
for (const key in newEnvVars) {
|
||||
// @ts-ignore
|
||||
delete env[key]
|
||||
// @ts-ignore
|
||||
delete coreEnv[key]
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(oldEnv)) {
|
||||
env._set(key, value)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue