2020-05-14 16:12:30 +02:00
|
|
|
const { tmpdir } = require("os")
|
2020-10-28 21:35:06 +01:00
|
|
|
const env = require("../src/environment")
|
2020-05-14 16:12:30 +02:00
|
|
|
|
2021-09-20 13:58:58 +02:00
|
|
|
env._set("SELF_HOSTED", "1")
|
2020-10-28 21:35:06 +01:00
|
|
|
env._set("NODE_ENV", "jest")
|
|
|
|
env._set("JWT_SECRET", "test-jwtsecret")
|
|
|
|
env._set("CLIENT_ID", "test-client-id")
|
|
|
|
env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
|
|
|
env._set("LOG_LEVEL", "silent")
|
2021-06-25 17:14:06 +02:00
|
|
|
env._set("PORT", 0)
|
2021-10-25 17:59:09 +02:00
|
|
|
|
2022-09-28 09:56:45 +02:00
|
|
|
const { mocks } = require("@budibase/backend-core/tests")
|
|
|
|
|
|
|
|
// 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-10-25 17:59:09 +02:00
|
|
|
global.console.log = jest.fn() // console.log are ignored in tests
|