Repository navigation
test(core): add unit tests for createPermitDeadline - #337
Sudhakar7J wants to merge 3 commits into
Conversation
|
The latest CI attempt for Build and secret scan passed; the full Test step was skipped. This finding is based on the current diff and CI log, not a local test run. |
dmae97
left a comment
There was a problem hiding this comment.
Thanks for adding these. All 6 tests pass locally, and the behavior they check matches createPermitDeadline.
CI is failing at the Check step (build-check-test) because of two Biome errors:
lint/style/useConstat line 72:let t = 0is never reassigned, so it should beconst;- formatting at about line 30:
() => createPermitDeadline(100, () => {}, () => value)needs to be split across lines.
Running npx biome check --write packages/coding-agent/test/permit-deadline.test.ts fixes both.
Optional: the function's doc comment also promises that delays longer than the 32-bit timer limit (2_147_483_647 ms) are split into chunks, and no test covers that yet. A fake-timer test for it would be a nice addition.
|
Rechecked The new CI run 42204086001 is |
Pin validation, clock-driven expiry, re-arming on lag, and cancel semantics for the monotonic queue deadline. Closes dmae97#329
9cf20c9 to
efbbbaf
Compare
|
Rechecked The remaining validation blocker is CI run 42283918523: |
Summary
Adds unit tests for
createPermitDeadlineinpackages/coding-agent/src/core/permit-deadline.ts, which currently has no dedicated test coverage. The function takes an injectable clock, making it straightforward to test without real waiting.Changes
packages/coding-agent/test/permit-deadline.test.ts(new): 6 tests covering:RangeErrorfor non-positive/non-finite durationsRangeErrorfor non-finite clock values at startexpired()follows the injected clockonExpireruns exactly once on expiry (fake timers)cancel()preventsonExpirefrom runningTesting
Result: 1 test file, 6 tests passed.
Related
Checklist