From a20977b7b02338a52a604077b46a5f7c0ebeb47d Mon Sep 17 00:00:00 2001 From: "Carlos R. L. Rodrigues" Date: Fri, 10 Jan 2025 07:31:46 -0300 Subject: [PATCH] rm timeout mock --- .../integration-tests/__tests__/index.spec.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts b/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts index 765d64facacbe..e2fa4d527a92d 100644 --- a/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts +++ b/packages/modules/workflow-engine-inmemory/integration-tests/__tests__/index.spec.ts @@ -12,9 +12,9 @@ import { Modules, TransactionHandlerType, } from "@medusajs/framework/utils" +import { moduleIntegrationTestRunner } from "@medusajs/test-utils" import { WorkflowsModuleService } from "@services" import { asFunction } from "awilix" -import { moduleIntegrationTestRunner } from "@medusajs/test-utils" import { setTimeout as setTimeoutPromise } from "timers/promises" import "../__fixtures__" import { @@ -332,15 +332,11 @@ moduleIntegrationTestRunner({ describe("Scheduled workflows", () => { beforeEach(() => { - jest.clearAllMocks() - }) - - beforeAll(() => { jest.useFakeTimers() - jest.spyOn(global, "setTimeout") + jest.clearAllMocks() }) - afterAll(() => { + afterEach(() => { jest.useRealTimers() }) @@ -348,11 +344,9 @@ moduleIntegrationTestRunner({ const spy = createScheduled("standard") await jest.runOnlyPendingTimersAsync() - expect(setTimeout).toHaveBeenCalledTimes(2) expect(spy).toHaveBeenCalledTimes(1) await jest.runOnlyPendingTimersAsync() - expect(setTimeout).toHaveBeenCalledTimes(3) expect(spy).toHaveBeenCalledTimes(2) })