diff --git a/packages/server/src/api/routes/tests/datasource.spec.ts b/packages/server/src/api/routes/tests/datasource.spec.ts index 42bb4e1973..53d04bdbff 100644 --- a/packages/server/src/api/routes/tests/datasource.spec.ts +++ b/packages/server/src/api/routes/tests/datasource.spec.ts @@ -19,11 +19,13 @@ describe("/datasources", () => { afterAll(setup.afterAll) - beforeEach(async () => { + async function setupTest() { await config.init() datasource = await config.createDatasource() jest.clearAllMocks() - }) + } + + beforeAll(setupTest) describe("create", () => { it("should create a new datasource", async () => { @@ -102,6 +104,8 @@ describe("/datasources", () => { }) describe("fetch", () => { + beforeAll(setupTest) + it("returns all the datasources from the server", async () => { const res = await request .get(`/api/datasources`) @@ -170,6 +174,8 @@ describe("/datasources", () => { }) describe("destroy", () => { + beforeAll(setupTest) + it("deletes queries for the datasource after deletion and returns a success message", async () => { await config.createQuery() diff --git a/packages/server/src/api/routes/tests/user.spec.js b/packages/server/src/api/routes/tests/user.spec.js index daac099cae..e5e280009e 100644 --- a/packages/server/src/api/routes/tests/user.spec.js +++ b/packages/server/src/api/routes/tests/user.spec.js @@ -3,6 +3,8 @@ const { checkPermissionsEndpoint } = require("./utilities/TestFunctions") const setup = require("./utilities") const { BUILTIN_ROLE_IDS } = roles +jest.setTimeout(30000) + jest.mock("../../../utilities/workerRequests", () => ({ getGlobalUsers: jest.fn(() => { return {} @@ -19,7 +21,8 @@ describe("/users", () => { afterAll(setup.afterAll) - beforeAll(async () => { + // For some reason this cannot be a beforeAll or the test "should be able to update the user" fail + beforeEach(async () => { await config.init() })