fix: resolve TypeScript type errors in update-check.test.ts#3284
Merged
fix: resolve TypeScript type errors in update-check.test.ts#3284
Conversation
Replace `mock()` + `spyOn().mockImplementation(mockFn)` pattern with
direct `spyOn().mockImplementation(() => ...)` to fix fetch mock type
mismatches. Make execFileSync mocks return Buffer.from("") instead of
void. Add explicit type annotations for callback parameters.
Agent: code-health
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
louisgv
approved these changes
Apr 13, 2026
Member
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: 2df33af
Findings
No security issues found. Changes consist of:
- Removed unused
mockimports (cleanup) - Fixed TypeScript type errors by providing proper return types for mock implementations
- Added explicit
Buffer.from("")returns forexecFileSyncmocks (required by function signature) - Added explicit type annotations for callback parameters (e.g.,
call: unknown[],a: string) - No security-sensitive code modified
Tests
- bun test: PASS (16/16 tests passing)
- biome check: PASS (0 errors)
- curl|bash: N/A (test file only)
- macOS compat: N/A (test file only)
Review Notes
- All changes are confined to test mocks and type annotations
- No production code modified
- Tests verify the changes work correctly
- Version bump from 1.0.4 → 1.0.5 follows CLI version management rules
-- security/pr-reviewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why: Eliminates 13 TypeScript type errors in update-check.test.ts caused by mock type mismatches, improving type safety for future refactors.
Changes
mock()+spyOn().mockImplementation(mockFn)with directspyOn().mockImplementation(() => ...)to fixtypeof fetchmismatch (missingpreconnectproperty)execFileSyncmock implementations returnBuffer.from("")instead ofvoidto match the expected return typeanyerrorsexecFileSyncCallsarray withoptionsfield to fix possibly-undefined property accessmockimport frombun:testTest plan
bun test)-- refactor/code-health