From fa38a4b37e0f56cc6aabcdd4f1835e9869d8c7cc Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 27 Oct 2021 13:10:46 +0100 Subject: [PATCH] Fixing test cases. --- packages/server/src/api/routes/tests/datasource.spec.js | 4 ++-- packages/server/src/api/routes/tests/query.spec.js | 1 - packages/server/src/tests/utilities/TestConfiguration.js | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/routes/tests/datasource.spec.js b/packages/server/src/api/routes/tests/datasource.spec.js index b6d94f714d..04f4dd77b8 100644 --- a/packages/server/src/api/routes/tests/datasource.spec.js +++ b/packages/server/src/api/routes/tests/datasource.spec.js @@ -26,8 +26,8 @@ describe("/datasources", () => { .expect('Content-Type', /json/) .expect(200) - expect(res.res.statusMessage).toEqual("Datasource saved successfully.") - expect(res.body.name).toEqual("Test") + expect(res.body.datasource.name).toEqual("Test") + expect(res.body.errors).toBeUndefined() }) }) diff --git a/packages/server/src/api/routes/tests/query.spec.js b/packages/server/src/api/routes/tests/query.spec.js index 716817509b..8f7bb4bc3e 100644 --- a/packages/server/src/api/routes/tests/query.spec.js +++ b/packages/server/src/api/routes/tests/query.spec.js @@ -1,7 +1,6 @@ // mock out postgres for this jest.mock("pg") -const { findLastKey } = require("lodash/fp") const setup = require("./utilities") const { checkBuilderEndpoint } = require("./utilities/TestFunctions") const { basicQuery, basicDatasource } = setup.structures diff --git a/packages/server/src/tests/utilities/TestConfiguration.js b/packages/server/src/tests/utilities/TestConfiguration.js index 0eb3851d98..1e0e47b7ea 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.js +++ b/packages/server/src/tests/utilities/TestConfiguration.js @@ -283,7 +283,8 @@ class TestConfiguration { async createDatasource(config = null) { config = config || basicDatasource() - this.datasource = await this._req(config, null, controllers.datasource.save) + const response = await this._req(config, null, controllers.datasource.save) + this.datasource = response.datasource return this.datasource }