2023-02-13 12:53:01 +01:00
|
|
|
import { mocks, testContainerUtils } from "@budibase/backend-core/tests"
|
2023-01-27 18:59:14 +01:00
|
|
|
import env from "../environment"
|
2023-03-27 20:38:49 +02:00
|
|
|
import { env as coreEnv, timers } from "@budibase/backend-core"
|
2023-01-27 18:59:14 +01: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
|
|
|
|
const tk = require("timekeeper")
|
|
|
|
tk.freeze(mocks.date.MOCK_DATE)
|
2021-05-05 18:49:34 +02:00
|
|
|
|
2022-08-25 20:41:47 +02:00
|
|
|
if (!process.env.CI) {
|
|
|
|
// set a longer timeout in dev for debugging
|
|
|
|
// 100 seconds
|
2023-02-09 10:19:31 +01:00
|
|
|
jest.setTimeout(100 * 1000)
|
|
|
|
} else {
|
|
|
|
jest.setTimeout(10 * 1000)
|
2022-08-25 20:41:47 +02:00
|
|
|
}
|
2023-01-27 18:59:14 +01:00
|
|
|
|
2023-01-31 12:23:26 +01:00
|
|
|
testContainerUtils.setupEnv(env, coreEnv)
|
2023-03-27 20:38:49 +02:00
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
timers.cleanup()
|
|
|
|
})
|