2022-05-03 23:58:19 +02:00
|
|
|
import env from "../src/environment"
|
2022-11-14 23:55:47 +01:00
|
|
|
import { mocks } from "./utilities"
|
2022-04-11 15:39:31 +02:00
|
|
|
|
2022-11-16 14:06:30 +01:00
|
|
|
// must explicitly enable fetch mock
|
|
|
|
mocks.fetch.enable()
|
|
|
|
|
2022-04-11 15:39:31 +02:00
|
|
|
// mock all dates to 2020-01-01T00:00:00.000Z
|
|
|
|
// use tk.reset() to use real dates in individual tests
|
2022-05-03 23:58:19 +02:00
|
|
|
import tk from "timekeeper"
|
2022-04-11 15:39:31 +02:00
|
|
|
tk.freeze(mocks.date.MOCK_DATE)
|
2021-07-15 13:55:35 +02:00
|
|
|
|
2021-09-20 13:58:58 +02:00
|
|
|
env._set("SELF_HOSTED", "1")
|
2021-07-15 13:55:35 +02:00
|
|
|
env._set("NODE_ENV", "jest")
|
|
|
|
env._set("JWT_SECRET", "test-jwtsecret")
|
|
|
|
env._set("LOG_LEVEL", "silent")
|
2022-11-15 16:50:15 +01:00
|
|
|
env._set("MINIO_URL", "http://localhost")
|
|
|
|
env._set("MINIO_ACCESS_KEY", "test")
|
|
|
|
env._set("MINIO_SECRET_KEY", "test")
|
2022-11-14 14:29:46 +01:00
|
|
|
|
|
|
|
global.console.log = jest.fn() // console.log are ignored in tests
|
|
|
|
|
|
|
|
if (!process.env.CI) {
|
|
|
|
// set a longer timeout in dev for debugging
|
|
|
|
// 100 seconds
|
|
|
|
jest.setTimeout(100000)
|
|
|
|
}
|