Skip to content

Commit eda590a

Browse files
committed
test: fix describe nesting, strengthen prune assertion, make stale-entry
check deterministic, restore timers in finally Review round on this unit's test quality: the viewStates describe block was nested inside the alwaysDenyUnapprovedCommands block, so reported test names carried the wrong subject; the prune test asserted survival with toDefined(), which passes even if pruning strips fields - the surviving entries are fully known, so assert their exact shape (matching the parallel-mode suite); the stale-temporary-entry test waited on a fixed 10 ms timer, so a slow load could let the negative assertion pass vacuously - await the load itself; the readiness-cancel test left fake timers active when an assertion failed before the restore line, hanging a later real-timer test - restore in a finally block. Proofs: global-settings 9/9, ClineProvider.spec 294/294, sticky-mode 33/33, api-task-control 23/23; negative controls: pruning that strips updatedAt reddens exactly the prune test, a loadViewState that adopts the unowned temporary-id entry reddens exactly the stale-entry test, restores byte-exact (hash match); eslint --max-warnings=0 clean (src and types); prettier clean.
1 parent 7b107d3 commit eda590a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/core/webview/__tests__/ClineProvider.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,8 +2229,8 @@ describe("ClineProvider", () => {
22292229
const pruned = provider["prunePersistedViewStates"](states)
22302230
expect(Object.keys(pruned)).toHaveLength(50)
22312231
// view-1/view-54 survive the true newest-50 selection; view-8 (updatedAt 1) does not.
2232-
expect(pruned["view-1"]).toBeDefined()
2233-
expect(pruned["view-54"]).toBeDefined()
2232+
expect(pruned["view-1"]).toEqual({ mode: "mode-1", updatedAt: 7 })
2233+
expect(pruned["view-54"]).toEqual({ mode: "mode-54", updatedAt: 48 })
22342234
expect(pruned["view-8"]).toBeUndefined()
22352235
await provider.dispose()
22362236
})

0 commit comments

Comments
 (0)