tweak tests
This commit is contained in:
parent
fc6c4d5290
commit
26fa3bd484
|
@ -6,12 +6,6 @@ import { DatabaseImpl } from "../db"
|
||||||
const dbList = new Set()
|
const dbList = new Set()
|
||||||
|
|
||||||
export function getDB(dbName?: string, opts?: any): Database {
|
export function getDB(dbName?: string, opts?: any): Database {
|
||||||
// TODO: once using the test image, need to remove this
|
|
||||||
// if (env.isTest()) {
|
|
||||||
// dbList.add(dbName)
|
|
||||||
// // @ts-ignore
|
|
||||||
// return getPouchDB(dbName, opts)
|
|
||||||
// }
|
|
||||||
return new DatabaseImpl(dbName, opts)
|
return new DatabaseImpl(dbName, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,10 +319,7 @@ async function performAppCreate(ctx: BBContext) {
|
||||||
const response = await db.put(newApplication, { force: true })
|
const response = await db.put(newApplication, { force: true })
|
||||||
newApplication._rev = response.rev
|
newApplication._rev = response.rev
|
||||||
|
|
||||||
/* istanbul ignore next */
|
await createApp(appId)
|
||||||
if (!env.isTest()) {
|
|
||||||
await createApp(appId)
|
|
||||||
}
|
|
||||||
|
|
||||||
await cache.app.invalidateAppMetadata(appId, newApplication)
|
await cache.app.invalidateAppMetadata(appId, newApplication)
|
||||||
return newApplication
|
return newApplication
|
||||||
|
@ -499,9 +496,7 @@ async function destroyApp(ctx: BBContext) {
|
||||||
await quotas.removeApp()
|
await quotas.removeApp()
|
||||||
await events.app.deleted(app)
|
await events.app.deleted(app)
|
||||||
|
|
||||||
if (!env.isTest()) {
|
await deleteApp(appId)
|
||||||
await deleteApp(appId)
|
|
||||||
}
|
|
||||||
|
|
||||||
await removeAppFromUserRoles(ctx, appId)
|
await removeAppFromUserRoles(ctx, appId)
|
||||||
await cache.app.invalidateAppMetadata(devAppId)
|
await cache.app.invalidateAppMetadata(devAppId)
|
||||||
|
|
|
@ -3,11 +3,6 @@ import { tmpdir } from "os"
|
||||||
|
|
||||||
env._set("SELF_HOSTED", "1")
|
env._set("SELF_HOSTED", "1")
|
||||||
env._set("NODE_ENV", "jest")
|
env._set("NODE_ENV", "jest")
|
||||||
env._set("CLIENT_ID", "test-client-id")
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
||||||
env._set("LOG_LEVEL", "silent")
|
env._set("LOG_LEVEL", "silent")
|
||||||
env._set("PORT", 0)
|
|
||||||
env._set("MINIO_URL", "http://localhost")
|
|
||||||
env._set("MINIO_ACCESS_KEY", "test")
|
|
||||||
env._set("MINIO_SECRET_KEY", "test")
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import env from "../environment"
|
import env from "../environment"
|
||||||
import { env as coreEnv } from "@budibase/backend-core"
|
import { env as coreEnv } from "@budibase/backend-core"
|
||||||
import { mocks } from "@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)
|
|
||||||
|
|
||||||
if (!process.env.DEBUG) {
|
if (!process.env.DEBUG) {
|
||||||
global.console.log = jest.fn() // console.log are ignored in tests
|
global.console.log = jest.fn() // console.log are ignored in tests
|
||||||
|
|
Loading…
Reference in New Issue