From b2488af6dac8d076726a7fb2a4ed2ca4006f35a4 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 6 Nov 2024 17:16:49 +0100 Subject: [PATCH] Use utils --- .../src/cache/tests/docWritethrough.spec.ts | 13 +++++++------ packages/backend-core/tests/core/utilities/index.ts | 1 - .../tests/core/utilities/utils/index.ts | 1 + .../tests/core/utilities/{ => utils}/queue.ts | 0 packages/pro | 2 +- .../src/api/routes/global/tests/auditLogs.spec.ts | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) rename packages/backend-core/tests/core/utilities/{ => utils}/queue.ts (100%) diff --git a/packages/backend-core/src/cache/tests/docWritethrough.spec.ts b/packages/backend-core/src/cache/tests/docWritethrough.spec.ts index cb8e2ff3fe..7e7e28bcb6 100644 --- a/packages/backend-core/src/cache/tests/docWritethrough.spec.ts +++ b/packages/backend-core/src/cache/tests/docWritethrough.spec.ts @@ -1,7 +1,12 @@ import tk from "timekeeper" import _ from "lodash" -import { DBTestConfiguration, generator, structures } from "../../../tests" +import { + DBTestConfiguration, + generator, + structures, + utils, +} from "../../../tests" import { getDB } from "../../db" import { @@ -13,11 +18,7 @@ import { const initialTime = Date.now() async function waitForQueueCompletion() { - do { - await DocWritethroughProcessor.queue.whenCurrentJobsFinished() - } while (await DocWritethroughProcessor.queue.count()) - - await DocWritethroughProcessor.queue.whenCurrentJobsFinished() + await utils.queue.processMessages(DocWritethroughProcessor.queue) } describe("docWritethrough", () => { diff --git a/packages/backend-core/tests/core/utilities/index.ts b/packages/backend-core/tests/core/utilities/index.ts index c3d81784c8..787d69be2c 100644 --- a/packages/backend-core/tests/core/utilities/index.ts +++ b/packages/backend-core/tests/core/utilities/index.ts @@ -4,4 +4,3 @@ export { generator } from "./structures" export * as testContainerUtils from "./testContainerUtils" export * as utils from "./utils" export * from "./jestUtils" -export * as queue from "./queue" diff --git a/packages/backend-core/tests/core/utilities/utils/index.ts b/packages/backend-core/tests/core/utilities/utils/index.ts index 41a249c7e6..3d28189c53 100644 --- a/packages/backend-core/tests/core/utilities/utils/index.ts +++ b/packages/backend-core/tests/core/utilities/utils/index.ts @@ -1 +1,2 @@ export * as time from "./time" +export * as queue from "./queue" diff --git a/packages/backend-core/tests/core/utilities/queue.ts b/packages/backend-core/tests/core/utilities/utils/queue.ts similarity index 100% rename from packages/backend-core/tests/core/utilities/queue.ts rename to packages/backend-core/tests/core/utilities/utils/queue.ts diff --git a/packages/pro b/packages/pro index 21e9cb4107..a35c797b1f 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 21e9cb41076c7064b6d5e16e0434705149440023 +Subproject commit a35c797b1f2cc067b6edd78d498bb2e239d677e1 diff --git a/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts b/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts index 601c3ffe62..b3717439e7 100644 --- a/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts +++ b/packages/worker/src/api/routes/global/tests/auditLogs.spec.ts @@ -1,4 +1,4 @@ -import { mocks, structures, queue } from "@budibase/backend-core/tests" +import { mocks, structures, utils } from "@budibase/backend-core/tests" import { context, events, features } from "@budibase/backend-core" import { Event, IdentityType } from "@budibase/types" import { TestConfiguration } from "../../../../tests" @@ -55,7 +55,7 @@ describe("/api/global/auditlogs (%s)", () => { await events.app.created(structures.apps.app(APP_ID)) }) - await queue.processMessages( + await utils.queue.processMessages( events.processors.auditLogsProcessor.queue )