-
-
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
Refactor: src/utils/timezoneUtils/dateTimeMiddleware.test.ts from Jest to Vitest #2775
Refactor: src/utils/timezoneUtils/dateTimeMiddleware.test.ts from Jest to Vitest #2775
Conversation
WalkthroughThe pull request updates the date time middleware test suite by migrating from the Jest mocking library to Vitest. This includes replacing Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2775 +/- ##
=====================================================
+ Coverage 65.12% 87.80% +22.67%
=====================================================
Files 296 313 +17
Lines 7369 8224 +855
Branches 1609 1855 +246
=====================================================
+ Hits 4799 7221 +2422
+ Misses 2336 804 -1532
+ Partials 234 199 -35 ☔ View full report in Codecov by Sentry. |
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.
See comment
Any progress? |
I'll do it by today please just give me sometime. |
Thanks for your patience. I'm overly curious about this. I'll give you some time. |
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 (2)
src/utils/timezoneUtils/dateTimeMiddleware.ts (2)
17-23
: Consider fallback handling for strings withoutT
delimiters.In this block, if
dateTimeStr
is invalid, it’s split on'T'
. Certain inputs without'T'
may result in an unexpectedtime
beingundefined
. Consider adding a fallback to handle strings lacking the'T'
delimiter more gracefully.
31-34
: Return logic is clear but consider logging or metrics for invalid inputs.The new conditional neatly handles invalid date strings by returning them unchanged. However, it might be beneficial to log or track such occurrences for debugging or usage monitoring.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/utils/timezoneUtils/dateTimeMiddleware.spec.ts
(6 hunks)src/utils/timezoneUtils/dateTimeMiddleware.ts
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/utils/timezoneUtils/dateTimeMiddleware.spec.ts
🔇 Additional comments (3)
src/utils/timezoneUtils/dateTimeMiddleware.ts (3)
38-41
: Maintain consistency in error-handling approach.
Similar to convertUTCToLocal
, returning the original string for invalid inputs is consistent. Just ensure the rest of the codebase properly handles these invalid values (if they persist downstream).
63-64
: Field reassignments look correct and consistent.
Updating obj[dateField]
and obj[timeField]
with the split date-time parts follows the intended flow. No issues detected here.
78-78
: No concerns with traversal recursion call.
This line simply continues the recursive call, which appears consistent with the rest of the function. Implementation seems valid.
hey @palisadoes I finally got the error the splitDateTime function wasn't handling the invalid date and time correctly, So I have adjust it accordingly and now it is working fine. Please do check it. |
It's good to see the progress |
Alright let me commit again and resolve the changes. |
Thanks. That's why we test. Sometimes the code is bad, sometimes it's the test |
154588e
into
PalisadoesFoundation:develop-postgres
Yeah! Well good to see it. Let me pick another issue now. |
Refactored src/utils/timezoneUtils/dateTimeMiddleware.test.ts to
src/utils/timezoneUtils/dateTimeMiddleware.spec.ts
Issue: #2756: #2756
Changes Implemented:
Refactored the testing framework from Jest to Vitest in src/utils/timezoneUtils/dateTimeMiddleware.test.ts.
Updated import statements, mocking methods, and assertions to align with Vitest conventions.
Verified compatibility with the existing codebase using Vitest.
From dateTimeMiddleware.test.ts → dateTimeMiddleware.spec.ts to follow the naming convention for Vitest.
Refactor:
src/utils/timezoneUtils/dateTimeMiddleware.test.ts
from Jest to Vitest #2756Other information
I have read the previous refactor PR and tried to keep things as uniform as possible.
Please suggest any other changes if required.
Summary by CodeRabbit
Tests
jest
tovitest
.Bug Fixes