2022-05-03 23:58:19 +02:00
|
|
|
import env from "../src/environment"
|
2023-03-27 20:38:49 +02:00
|
|
|
import { cleanup } from "../src/timers"
|
2023-02-13 12:53:01 +01:00
|
|
|
import { mocks, testContainerUtils } from "./utilities"
|
|
|
|
|
|
|
|
// must explicitly enable fetch mock
|
|
|
|
mocks.fetch.enable()
|
|
|
|
|
|
|
|
// mock all dates to 2020-01-01T00:00:00.000Z
|
|
|
|
// use tk.reset() to use real dates in individual tests
|
|
|
|
import tk from "timekeeper"
|
|
|
|
tk.freeze(mocks.date.MOCK_DATE)
|
|
|
|
|
|
|
|
if (!process.env.DEBUG) {
|
|
|
|
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)
|
|
|
|
}
|
2022-04-11 15:39:31 +02:00
|
|
|
|
2023-01-31 12:23:26 +01:00
|
|
|
testContainerUtils.setupEnv(env)
|
2023-03-27 20:38:49 +02:00
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
cleanup()
|
|
|
|
})
|