1
0
Fork 0
mirror of synced 2024-06-30 20:10:54 +12:00

Fix tests.

This commit is contained in:
Sam Rose 2023-12-11 17:20:00 +00:00
parent 2c3b3d03e1
commit e0243b495c
No known key found for this signature in database
4 changed files with 20 additions and 5 deletions

View file

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

View file

@ -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) => {

View file

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

View file

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