From ea5b515783d2896bace11d02dff2ba6851090ffa Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 4 Jan 2023 19:47:56 +0000 Subject: [PATCH] Playing around with getting tests working. --- packages/backend-core/src/db/db.ts | 10 +++++----- packages/server/src/tests/jestSetup.ts | 2 ++ packages/worker/src/tests/jestSetup.ts | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/backend-core/src/db/db.ts b/packages/backend-core/src/db/db.ts index 3887e8b09f..c54a4faea4 100644 --- a/packages/backend-core/src/db/db.ts +++ b/packages/backend-core/src/db/db.ts @@ -7,11 +7,11 @@ const dbList = new Set() 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) - } + // if (env.isTest()) { + // dbList.add(dbName) + // // @ts-ignore + // return getPouchDB(dbName, opts) + // } return new DatabaseImpl(dbName, opts) } diff --git a/packages/server/src/tests/jestSetup.ts b/packages/server/src/tests/jestSetup.ts index b53ac2d9fa..cebc01b864 100644 --- a/packages/server/src/tests/jestSetup.ts +++ b/packages/server/src/tests/jestSetup.ts @@ -11,6 +11,8 @@ env._set("PORT", 0) env._set("MINIO_URL", "http://localhost") env._set("MINIO_ACCESS_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" diff --git a/packages/worker/src/tests/jestSetup.ts b/packages/worker/src/tests/jestSetup.ts index ab82cb5be7..467ea73c79 100644 --- a/packages/worker/src/tests/jestSetup.ts +++ b/packages/worker/src/tests/jestSetup.ts @@ -1,4 +1,5 @@ import env from "../environment" +import { env as coreEnv } from "@budibase/backend-core" env._set("SELF_HOSTED", "0") env._set("NODE_ENV", "jest") @@ -11,6 +12,8 @@ env._set("MINIO_SECRET_KEY", "test") env._set("PLATFORM_URL", "http://localhost:10000") env._set("INTERNAL_API_KEY", "test") 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"