Fix flaky test
This commit is contained in:
parent
6ac57d424c
commit
4522d6c906
|
@ -19,11 +19,13 @@ describe("/datasources", () => {
|
||||||
|
|
||||||
afterAll(setup.afterAll)
|
afterAll(setup.afterAll)
|
||||||
|
|
||||||
beforeEach(async () => {
|
async function setupTest() {
|
||||||
await config.init()
|
await config.init()
|
||||||
datasource = await config.createDatasource()
|
datasource = await config.createDatasource()
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
})
|
}
|
||||||
|
|
||||||
|
beforeAll(setupTest)
|
||||||
|
|
||||||
describe("create", () => {
|
describe("create", () => {
|
||||||
it("should create a new datasource", async () => {
|
it("should create a new datasource", async () => {
|
||||||
|
@ -102,6 +104,8 @@ describe("/datasources", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("fetch", () => {
|
describe("fetch", () => {
|
||||||
|
beforeAll(setupTest)
|
||||||
|
|
||||||
it("returns all the datasources from the server", async () => {
|
it("returns all the datasources from the server", async () => {
|
||||||
const res = await request
|
const res = await request
|
||||||
.get(`/api/datasources`)
|
.get(`/api/datasources`)
|
||||||
|
@ -170,6 +174,8 @@ describe("/datasources", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("destroy", () => {
|
describe("destroy", () => {
|
||||||
|
beforeAll(setupTest)
|
||||||
|
|
||||||
it("deletes queries for the datasource after deletion and returns a success message", async () => {
|
it("deletes queries for the datasource after deletion and returns a success message", async () => {
|
||||||
await config.createQuery()
|
await config.createQuery()
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
|
||||||
const setup = require("./utilities")
|
const setup = require("./utilities")
|
||||||
const { BUILTIN_ROLE_IDS } = roles
|
const { BUILTIN_ROLE_IDS } = roles
|
||||||
|
|
||||||
|
jest.setTimeout(30000)
|
||||||
|
|
||||||
jest.mock("../../../utilities/workerRequests", () => ({
|
jest.mock("../../../utilities/workerRequests", () => ({
|
||||||
getGlobalUsers: jest.fn(() => {
|
getGlobalUsers: jest.fn(() => {
|
||||||
return {}
|
return {}
|
||||||
|
@ -19,7 +21,8 @@ describe("/users", () => {
|
||||||
|
|
||||||
afterAll(setup.afterAll)
|
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()
|
await config.init()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue