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, } })