From 141790ef708a3f8b7fc1a8fb1e2a5dc7b7a4ce21 Mon Sep 17 00:00:00 2001 From: adrinr Date: Fri, 3 Feb 2023 16:28:29 +0000 Subject: [PATCH] Fix automation timeouts --- packages/server/src/api/routes/tests/automation.spec.js | 6 +++++- packages/server/src/tests/utilities/TestConfiguration.ts | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/routes/tests/automation.spec.js b/packages/server/src/api/routes/tests/automation.spec.js index 616424d9d7..e942e7a722 100644 --- a/packages/server/src/api/routes/tests/automation.spec.js +++ b/packages/server/src/api/routes/tests/automation.spec.js @@ -16,9 +16,13 @@ describe("/automations", () => { afterAll(setup.afterAll) - beforeEach(async () => { + beforeAll(async () => { await config.init() }) + + beforeEach(() => { + jest.clearAllMocks() + }) describe("get definitions", () => { it("returns a list of definitions for actions", async () => { diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index 9406f3f049..510cb1bf42 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -39,7 +39,7 @@ import { cleanup } from "../../utilities/fileSystem" import newid from "../../db/newid" import { generateUserMetadataID } from "../../db/utils" import { startup } from "../../startup" -import { AuthToken } from "@budibase/types" +import { AuthToken, Database } from "@budibase/types" const supertest = require("supertest") type DefaultUserValues = { @@ -229,7 +229,7 @@ class TestConfiguration { email = this.defaultUserValues.email, roles, }: any = {}) { - return tenancy.doWithGlobalDB(this.getTenantId(), async (db: any) => { + return tenancy.doWithGlobalDB(this.getTenantId(), async (db: Database) => { let existing try { existing = await db.get(id) @@ -261,7 +261,7 @@ class TestConfiguration { } const resp = await db.put(user) return { - _rev: resp._rev, + _rev: resp.rev, ...user, } })