From 120344ccae7936b154ef25a0d508a068e057bf75 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 24 Apr 2020 18:02:51 +0100 Subject: [PATCH] fixing tests --- .../components/database/ModelDataTable/api.js | 4 +- .../modals/CreateEditRecord.svelte | 17 +-- .../ModelDataTable/modals/CreateUser.svelte | 14 +-- packages/server/config.js | 13 +++ .../server/middleware/controllers/client.js | 2 +- .../server/middleware/controllers/instance.js | 6 +- .../server/middleware/controllers/record.js | 11 +- .../routes/neo/tests/application.spec.js | 2 +- .../routes/neo/tests/client.spec.js | 7 +- .../routes/neo/tests/couchTestUtils.js | 57 ++++++---- .../routes/neo/tests/instance.spec.js | 7 +- .../middleware/routes/neo/tests/model.spec.js | 18 ++-- .../routes/neo/tests/record.spec.js | 100 ++++++++++-------- .../middleware/routes/neo/tests/user.spec.js | 17 +-- .../middleware/routes/neo/tests/view.spec.js | 11 +- packages/server/testing/000005.ldb | Bin 0 -> 237 bytes packages/server/testing/CURRENT | 1 + packages/server/testing/LOCK | 0 packages/server/testing/LOG | 5 + packages/server/testing/LOG.old | 1 + packages/server/testing/MANIFEST-000004 | Bin 0 -> 123 bytes 21 files changed, 178 insertions(+), 115 deletions(-) create mode 100644 packages/server/config.js create mode 100644 packages/server/testing/000005.ldb create mode 100644 packages/server/testing/CURRENT create mode 100644 packages/server/testing/LOCK create mode 100644 packages/server/testing/LOG create mode 100644 packages/server/testing/LOG.old create mode 100644 packages/server/testing/MANIFEST-000004 diff --git a/packages/builder/src/components/database/ModelDataTable/api.js b/packages/builder/src/components/database/ModelDataTable/api.js index a0f3105397..d35348b180 100644 --- a/packages/builder/src/components/database/ModelDataTable/api.js +++ b/packages/builder/src/components/database/ModelDataTable/api.js @@ -27,8 +27,8 @@ export async function loadRecord(key, { appname, instanceId }) { return await response.json() } -export async function saveRecord({ record, instanceId, modelId }) { - const SAVE_RECORDS_URL = `/api/${instanceId}/${modelId}/records` +export async function saveRecord(record, instanceId) { + const SAVE_RECORDS_URL = `/api/${instanceId}/records` const response = await api.post(SAVE_RECORDS_URL, record) return await response.json() } diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index 380442fa71..90755da980 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -43,19 +43,22 @@ } async function saveRecord() { - const recordResponse = await api.saveRecord({ - record, - instanceId, - modelId: $backendUiStore.selectedModel._id - }) + const recordResponse = await api.saveRecord( + { + ...record, + modelId: $backendUiStore.selectedModel._id, + }, + instanceId + ) if (recordResponse.errors) { - errors = recordResponse.errors; - return; + errors = recordResponse.errors + return } backendUiStore.update(state => { state.selectedView = state.selectedView return state + onClosed(); }) } diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte index 28e396d5c3..7d1037fce3 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateUser.svelte @@ -14,7 +14,6 @@ async function createUser() { const user = { name: username, username, password } const response = await api.createUser(user, instanceId); - console.log(response); backendUiStore.actions.users.create(response) onClosed() } @@ -22,11 +21,14 @@
- - - - - +
+ + +
+
+ + +