Skip to content

Commit 54db582

Browse files
committed
improve QUEUED_EXECUTING test
1 parent 0ed24db commit 54db582

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

packages/cli-v3/src/entryPoints/managed/snapshot.test.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { SnapshotManager } from "./snapshot.js";
22
import { ConsoleRunLogger } from "./logger.js";
3-
import { RunExecutionData, TaskRunExecutionStatus, TaskRunStatus } from "@trigger.dev/core/v3";
3+
import { RunExecutionData, TaskRunExecutionStatus } from "@trigger.dev/core/v3";
44
import { setTimeout } from "timers/promises";
5+
import { isCI } from "std-env";
56

67
describe("SnapshotManager", () => {
7-
const mockLogger = new ConsoleRunLogger();
8+
const mockLogger = new ConsoleRunLogger({ print: !isCI });
89
const mockSnapshotHandler = vi.fn();
910
const mockSuspendableHandler = vi.fn();
1011

@@ -94,22 +95,13 @@ describe("SnapshotManager", () => {
9495
// Reset mocks
9596
vi.clearAllMocks();
9697

97-
// This should also work with QUEUED_EXECUTING
98-
await manager.setSuspendable(false);
99-
expect(manager.suspendable).toBe(false);
100-
101-
// Update the snapshot to QUEUED_EXECUTING
98+
// Transitioning to QUEUED_EXECUTING should call the handler again
10299
await manager.handleSnapshotChange(
103100
createRunExecutionData({
104101
snapshotId: "snapshot-3",
105102
executionStatus: "QUEUED_EXECUTING",
106103
})
107104
);
108-
expect(mockSuspendableHandler).not.toHaveBeenCalled();
109-
110-
// Set suspendable to true and check that the handler is called
111-
await manager.setSuspendable(true);
112-
expect(manager.suspendable).toBe(true);
113105
expect(mockSuspendableHandler).toHaveBeenCalledWith({
114106
id: "snapshot-3",
115107
status: "QUEUED_EXECUTING",
@@ -444,8 +436,6 @@ describe("SnapshotManager", () => {
444436
}
445437
}
446438

447-
console.log(manager.queueLength);
448-
449439
await Promise.all(promises);
450440

451441
// Verify handler execution exclusivity

0 commit comments

Comments
 (0)