|
1 | 1 | import { SnapshotManager } from "./snapshot.js";
|
2 | 2 | import { ConsoleRunLogger } from "./logger.js";
|
3 |
| -import { RunExecutionData, TaskRunExecutionStatus, TaskRunStatus } from "@trigger.dev/core/v3"; |
| 3 | +import { RunExecutionData, TaskRunExecutionStatus } from "@trigger.dev/core/v3"; |
4 | 4 | import { setTimeout } from "timers/promises";
|
| 5 | +import { isCI } from "std-env"; |
5 | 6 |
|
6 | 7 | describe("SnapshotManager", () => {
|
7 |
| - const mockLogger = new ConsoleRunLogger(); |
| 8 | + const mockLogger = new ConsoleRunLogger({ print: !isCI }); |
8 | 9 | const mockSnapshotHandler = vi.fn();
|
9 | 10 | const mockSuspendableHandler = vi.fn();
|
10 | 11 |
|
@@ -94,22 +95,13 @@ describe("SnapshotManager", () => {
|
94 | 95 | // Reset mocks
|
95 | 96 | vi.clearAllMocks();
|
96 | 97 |
|
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 |
102 | 99 | await manager.handleSnapshotChange(
|
103 | 100 | createRunExecutionData({
|
104 | 101 | snapshotId: "snapshot-3",
|
105 | 102 | executionStatus: "QUEUED_EXECUTING",
|
106 | 103 | })
|
107 | 104 | );
|
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); |
113 | 105 | expect(mockSuspendableHandler).toHaveBeenCalledWith({
|
114 | 106 | id: "snapshot-3",
|
115 | 107 | status: "QUEUED_EXECUTING",
|
@@ -444,8 +436,6 @@ describe("SnapshotManager", () => {
|
444 | 436 | }
|
445 | 437 | }
|
446 | 438 |
|
447 |
| - console.log(manager.queueLength); |
448 |
| - |
449 | 439 | await Promise.all(promises);
|
450 | 440 |
|
451 | 441 | // Verify handler execution exclusivity
|
|
0 commit comments