Add utils
This commit is contained in:
parent
f7f056ef76
commit
505146f4b3
|
@ -4,3 +4,4 @@ export { generator } from "./structures"
|
|||
export * as testContainerUtils from "./testContainerUtils"
|
||||
export * as utils from "./utils"
|
||||
export * from "./jestUtils"
|
||||
export * as queue from "./queue"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import { Queue } from "bull"
|
||||
|
||||
export async function processMessages(queue: Queue) {
|
||||
do {
|
||||
await queue.whenCurrentJobsFinished()
|
||||
} while (await queue.count())
|
||||
|
||||
await queue.whenCurrentJobsFinished()
|
||||
}
|
|
@ -12,33 +12,24 @@ const BASE_IDENTITY = {
|
|||
const USER_AUDIT_LOG_COUNT = 3
|
||||
const APP_ID = "app_1"
|
||||
|
||||
describe("/api/global/auditlogs (%s)", () => {
|
||||
describe.each(["lucene", "sql"])("/api/global/auditlogs (%s)", method => {
|
||||
const config = new TestConfiguration()
|
||||
|
||||
beforeAll(async () => {
|
||||
await config.beforeAll()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await config.afterAll()
|
||||
})
|
||||
|
||||
describe.each(["lucene", "sql"])(
|
||||
"POST /api/global/auditlogs/search",
|
||||
method => {
|
||||
let envCleanup: (() => void) | undefined
|
||||
|
||||
beforeAll(async () => {
|
||||
envCleanup = features.testutils.setFeatureFlags("*", {
|
||||
SQS: method === "sql",
|
||||
})
|
||||
await config.beforeAll()
|
||||
await config.useNewTenant()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
afterAll(async () => {
|
||||
envCleanup?.()
|
||||
await config.afterAll()
|
||||
})
|
||||
|
||||
describe("POST /api/global/auditlogs/search", () => {
|
||||
it("should be able to fire some events (create audit logs)", async () => {
|
||||
await context.doInTenant(config.tenantId, async () => {
|
||||
const userId = config.user!._id!
|
||||
|
@ -127,6 +118,5 @@ describe("/api/global/auditlogs (%s)", () => {
|
|||
expect(log.name.includes("User")).toBe(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -123,11 +123,11 @@ class TestConfiguration {
|
|||
}
|
||||
|
||||
async afterAll() {
|
||||
if (this.server) {
|
||||
await this.server.close()
|
||||
} else {
|
||||
await require("../index").default.close()
|
||||
}
|
||||
// if (this.server) {
|
||||
// await this.server.close()
|
||||
// } else {
|
||||
// await require("../index").default.close()
|
||||
// }
|
||||
}
|
||||
|
||||
// TENANCY
|
||||
|
|
Loading…
Reference in New Issue