Playing around with getting tests working.

This commit is contained in:
mike12345567 2023-01-04 19:47:56 +00:00
parent a83eb00872
commit ea5b515783
3 changed files with 10 additions and 5 deletions

View File

@ -7,11 +7,11 @@ 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 // TODO: once using the test image, need to remove this
if (env.isTest()) { // if (env.isTest()) {
dbList.add(dbName) // dbList.add(dbName)
// @ts-ignore // // @ts-ignore
return getPouchDB(dbName, opts) // return getPouchDB(dbName, opts)
} // }
return new DatabaseImpl(dbName, opts) return new DatabaseImpl(dbName, opts)
} }

View File

@ -11,6 +11,8 @@ env._set("PORT", 0)
env._set("MINIO_URL", "http://localhost") env._set("MINIO_URL", "http://localhost")
env._set("MINIO_ACCESS_KEY", "test") env._set("MINIO_ACCESS_KEY", "test")
env._set("MINIO_SECRET_KEY", "test") env._set("MINIO_SECRET_KEY", "test")
env._set("COUCH_DB_USER", "budibase")
env._set("COUCH_DB_PASSWORD", "budibase")
import { mocks } from "@budibase/backend-core/tests" import { mocks } from "@budibase/backend-core/tests"

View File

@ -1,4 +1,5 @@
import env from "../environment" import env from "../environment"
import { env as coreEnv } from "@budibase/backend-core"
env._set("SELF_HOSTED", "0") env._set("SELF_HOSTED", "0")
env._set("NODE_ENV", "jest") env._set("NODE_ENV", "jest")
@ -11,6 +12,8 @@ env._set("MINIO_SECRET_KEY", "test")
env._set("PLATFORM_URL", "http://localhost:10000") env._set("PLATFORM_URL", "http://localhost:10000")
env._set("INTERNAL_API_KEY", "test") env._set("INTERNAL_API_KEY", "test")
env._set("DISABLE_ACCOUNT_PORTAL", false) env._set("DISABLE_ACCOUNT_PORTAL", false)
coreEnv._set("COUCH_DB_USER", "budibase")
coreEnv._set("COUCH_DB_PASSWORD", "budibase")
import { mocks } from "@budibase/backend-core/tests" import { mocks } from "@budibase/backend-core/tests"