-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(cli): improve test coverage in cli api handling #1408
base: main
Are you sure you want to change the base?
test(cli): improve test coverage in cli api handling #1408
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@spirulence is attempting to deploy a commit to the Codemod Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some self-review
vi.clearAllMocks(); | ||
|
||
// Reset process.env | ||
process.env.BACKEND_URL = "http://api.example.com"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to find another solution for this.
({ | ||
request: mockRequestMethod, | ||
// biome-ignore lint/suspicious/noExplicitAny: This is a mock implementation | ||
}) as any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this. But a concise way to bring in the rest of the Octokit implementation eluded me today
() => | ||
({ | ||
request: mockRequestMethod, | ||
// biome-ignore lint/suspicious/noExplicitAny: This is a mock implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same complaint here about Octokit mocking
() => | ||
({ | ||
request: mockRequestMethod, | ||
// biome-ignore lint/suspicious/noExplicitAny: This is a mock implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same complaint about octokit mocking
() => | ||
({ | ||
request: mockRequestMethod, | ||
// biome-ignore lint/suspicious/noExplicitAny: This is a mock implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same complaint about Octokit mocking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks! 🎉 Just one comment.
@mohab-sameh I got caught off-guard here by the fact that |
📚 Description
This PR improves the unit test coverage of the cli application. New tests for
apps/cli/src/api.ts
are included.Previous code coverage report (commit f3fc6be )
npx vitest --coverage
New coverage report
🔗 Linked Issue
Makes progress on #1407
🧪 Test Plan
Test only change. New tests attached. Axios and Octokit dependencies mocked where applicable.
Line 23 in api.ts appears to have an unreachable branch which could be addressed in a follow-on effort.
📄 Documentation to Update
No documentation identified.