From b1b73e13808c57ef03b5d3f153453ba003d61669 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 1 Jun 2021 17:09:26 +0100 Subject: [PATCH] fixing various babel issues within tests --- packages/server/src/api/controllers/datasource.js | 6 +++--- packages/server/src/middleware/tests/authorized.spec.js | 2 +- packages/server/src/middleware/tests/resourceId.spec.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/server/src/api/controllers/datasource.js b/packages/server/src/api/controllers/datasource.js index fa4bdf289b..1d9469f2e7 100644 --- a/packages/server/src/api/controllers/datasource.js +++ b/packages/server/src/api/controllers/datasource.js @@ -30,9 +30,9 @@ exports.save = async function (ctx) { datasource._rev = response.rev // Drain connection pools when configuration is changed - const pool = integrations[datasource.source].pool - if (pool) { - await pool.end() + const source = integrations[datasource.source] + if (source && source.pool) { + await source.pool.end() } ctx.status = 200 diff --git a/packages/server/src/middleware/tests/authorized.spec.js b/packages/server/src/middleware/tests/authorized.spec.js index 50e1b1dcf2..afa6157eaa 100644 --- a/packages/server/src/middleware/tests/authorized.spec.js +++ b/packages/server/src/middleware/tests/authorized.spec.js @@ -5,7 +5,7 @@ jest.mock("../../environment", () => ({ prod: false, isTest: () => true, isProd: () => this.prod, - _set: (key, value) => { + _set: function(key, value) { this.prod = value === "production" } }) diff --git a/packages/server/src/middleware/tests/resourceId.spec.js b/packages/server/src/middleware/tests/resourceId.spec.js index 35e6e5af50..56d89cfede 100644 --- a/packages/server/src/middleware/tests/resourceId.spec.js +++ b/packages/server/src/middleware/tests/resourceId.spec.js @@ -91,7 +91,7 @@ describe("resourceId middleware", () => { .mainResource("custom") .subResource("customSub") .build() - config = new TestConfiguration(middleware) + let config = new TestConfiguration(middleware) config.setBody({ custom: "test", customSub: "subtest"