From e575c0b929c94d272464d32f9ad2763e8c9b0316 Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Fri, 24 Apr 2020 10:03:31 +0100 Subject: [PATCH] bugfix, create client db not passing config --- packages/server/db/createClientDb.js | 6 +++--- .../server/middleware/routes/neo/tests/couchTestUtils.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/server/db/createClientDb.js b/packages/server/db/createClientDb.js index b7ba0571f1..2eb40e02a0 100644 --- a/packages/server/db/createClientDb.js +++ b/packages/server/db/createClientDb.js @@ -1,9 +1,9 @@ const CouchDb = require(".") -module.exports = async clientId => { - await CouchDb.db.create(clientId) +module.exports = async (config, clientId) => { + await CouchDb.db.create(`client-${clientId}`) - const db = CouchDb.db.use(clientId) + const db = CouchDb(config).db.use(`client-${clientId}`) await db.insert( { diff --git a/packages/server/middleware/routes/neo/tests/couchTestUtils.js b/packages/server/middleware/routes/neo/tests/couchTestUtils.js index 4892f11678..9a2ed4aeeb 100644 --- a/packages/server/middleware/routes/neo/tests/couchTestUtils.js +++ b/packages/server/middleware/routes/neo/tests/couchTestUtils.js @@ -1,5 +1,7 @@ const couchdb = require("../../../../db")({ database: "couch" }) -const createClientDb = require("../../../../db/createClientDb") +const createClientDb = require("../../../../db/createClientDb")({ + database: "couch", +}) const CLIENT_DB_ID = "client-testing"; const TEST_APP_ID = "test-app";