Skip to content

Commit b76c6b4

Browse files
committed
test: add checkpoint initialization timeout tests for default and custom settings
1 parent 28a4bc3 commit b76c6b4

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/core/task/__tests__/Task.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,5 +1334,52 @@ describe("Cline", () => {
13341334
expect(task.diffStrategy).toBeUndefined()
13351335
})
13361336
})
1337+
1338+
describe("checkpoint initialization timeout", () => {
1339+
it("should use default timeout when not specified", async () => {
1340+
const task = new Task({
1341+
provider: mockProvider,
1342+
apiConfiguration: mockApiConfig,
1343+
enableCheckpoints: true,
1344+
task: "test task",
1345+
startTask: false,
1346+
})
1347+
1348+
// Verify default timeout is set
1349+
expect(task.checkpointInitTimeoutMs).toBe(10000) // DEFAULT_CKPT_INIT_TIMEOUT_MS
1350+
})
1351+
1352+
it("should use custom timeout when specified", async () => {
1353+
const customTimeout = 5000
1354+
const task = new Task({
1355+
provider: mockProvider,
1356+
apiConfiguration: mockApiConfig,
1357+
enableCheckpoints: true,
1358+
checkpointInitTimeoutMs: customTimeout,
1359+
task: "test task",
1360+
startTask: false,
1361+
})
1362+
1363+
// Verify custom timeout is set
1364+
expect(task.checkpointInitTimeoutMs).toBe(customTimeout)
1365+
})
1366+
1367+
it("should disable checkpoints when not enabled", async () => {
1368+
const task = new Task({
1369+
provider: mockProvider,
1370+
apiConfiguration: mockApiConfig,
1371+
enableCheckpoints: false,
1372+
task: "test task",
1373+
startTask: false,
1374+
})
1375+
1376+
// Access private method through prototype
1377+
const ensureCheckpointInitialization = (task as any).ensureCheckpointInitialization.bind(task)
1378+
await ensureCheckpointInitialization()
1379+
1380+
// Should remain disabled
1381+
expect(task.enableCheckpoints).toBe(false)
1382+
})
1383+
})
13371384
})
13381385
})

0 commit comments

Comments
 (0)