From 8c922f5d088358c58c34656c59a171210cac5414 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 13 Apr 2020 17:08:53 +0100 Subject: [PATCH] integration test setup --- packages/server/middleware/controllers/view.js | 2 +- .../routes/neo/tests/__snapshots__/view.spec.js.snap | 5 +++++ packages/server/middleware/routes/neo/view.js | 3 ++- packages/server/package.json | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/server/middleware/controllers/view.js b/packages/server/middleware/controllers/view.js index 4edc92745b..71a887a709 100644 --- a/packages/server/middleware/controllers/view.js +++ b/packages/server/middleware/controllers/view.js @@ -24,7 +24,7 @@ const controller = { } }, destroy: async ctx => { - const database = couchdb.db.use(ctx.params.databaseId); + const database = couchdb.db.use(ctx.params.instanceId); ctx.body = await database.destroy(ctx.params.userId) } } diff --git a/packages/server/middleware/routes/neo/tests/__snapshots__/view.spec.js.snap b/packages/server/middleware/routes/neo/tests/__snapshots__/view.spec.js.snap index 60a0a6cfcd..39ae3011a3 100644 --- a/packages/server/middleware/routes/neo/tests/__snapshots__/view.spec.js.snap +++ b/packages/server/middleware/routes/neo/tests/__snapshots__/view.spec.js.snap @@ -2,6 +2,11 @@ exports[`/views fetch returns a list of all the views that exist in the instance database 1`] = ` Object { + "all_89baeed104b7f2e3fd977e9bc2039d5c": Object { + "map": "function (doc) { + emit([doc.modelId], doc._id); + }", + }, "by_type": Object { "map": "function (doc) { emit([doc.type], doc._id); diff --git a/packages/server/middleware/routes/neo/view.js b/packages/server/middleware/routes/neo/view.js index 22fdcee518..fbd956d954 100644 --- a/packages/server/middleware/routes/neo/view.js +++ b/packages/server/middleware/routes/neo/view.js @@ -5,7 +5,8 @@ const router = Router(); router .get("/api/:instanceId/views", controller.fetch) - .post("/api/:instanceId/views", controller.create); // .patch("/api/:databaseId/views", controller.update); + // .delete("/api/:instanceId/views/:viewId/:revId", controller.destroy); + .post("/api/:instanceId/views", controller.create); module.exports = router; \ No newline at end of file diff --git a/packages/server/package.json b/packages/server/package.json index ebc6d30826..b8507c851d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "test": "jest apps && jest builder", + "test:integration": "jest neo --runInBand", "test:watch": "jest -w", "build": "cd appPackages/_master && yarn && cd ../testApp && yarn && cd ../testApp2 && yarn", "initialise": "node ./initialise/initialiseBudibase init -d ./myapps -c contributors -u admin -p admin",