-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
Refactored src/utils/convertToBase64.test.ts from Jest to Vitest #2802
Refactored src/utils/convertToBase64.test.ts from Jest to Vitest #2802
Conversation
WalkthroughThe pull request focuses on refactoring the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/utils/convertToBase64.spec.ts (1)
Line range hint
20-24
: Good use of Vitest'sspyOn
for mocking.Mocking
FileReader
this way ensures the test covers error cases. However, consider placing the mock setup in abeforeEach
or at the start of the test block for clarity, and themockRestore()
call in anafterEach
to keep setup/teardown blocks consistent.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/utils/convertToBase64.spec.ts
(3 hunks)
🔇 Additional comments (2)
src/utils/convertToBase64.spec.ts (2)
1-1
: Excellent transition to Vitest imports.
This import statement cleanly switches the test framework from Jest to Vitest. Everything looks consistent with Vitest usage.
33-33
: Restoring the mock at the end prevents shared state issues.
It's great to see mockRestore()
used; it prevents side effects in subsequent tests. If multiple tests need to mock FileReader
, you might centralize mock setup/teardown in dedicated lifecycle hooks.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2802 +/- ##
=====================================================
+ Coverage 70.01% 87.55% +17.53%
=====================================================
Files 296 313 +17
Lines 7358 8204 +846
Branches 1606 1792 +186
=====================================================
+ Hits 5152 7183 +2031
+ Misses 1960 827 -1133
+ Partials 246 194 -52 ☔ View full report in Codecov by Sentry. |
45d18b6
into
PalisadoesFoundation:develop-postgres
I have one question @palisadoes ... I see package-lock.json uploaded on the github for all the branches and it is not in the gitignore... is there any specific reason for that or is it a bug? |
Okay I see |
What kind of change does this PR introduce?
Refactoring
Issue Number:
Fixes #2759
Did you add tests for your changes?
NO
Snapshots/Videos:
Modified the file and ran the
npm run test:vitest
command to check and it was cleared:Also ran the specific file vitest
npx vitest run .\src\utils\convertToBase64.spec.ts
:And ensured the linting and formatting:
If relevant, did you update the documentation?
Not yet
Summary
Does this PR introduce a breaking change?
No... it simply converts one test suite framework to other.
Other information
Have checked all the points in the Acceptance Criteria that was asked in the Issue:
Have you read the contributing guide?
Yes
Summary by CodeRabbit
convertToBase64
functionality to utilize thevitest
framework.FileReader
.