Added Tests for: src/graphql/types/User/homePhoneNumber.ts#5352
Added Tests for: src/graphql/types/User/homePhoneNumber.ts#5352Ayush4958 wants to merge 4 commits intoPalisadoesFoundation:developfrom
Conversation
Our Pull Request Approval ProcessThis PR will be reviewed according to our: Your PR may be automatically closed if:
Thanks for contributing! |
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds a Vitest test suite for the GraphQL Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 9 minutes and 6 seconds.Comment |
4cb55f8 to
da0d17c
Compare
|
Please fix the failing test |
Signed-off-by: Ayush <bhandariayush935@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/graphql/types/User/homePhoneNumber.test.ts`:
- Around line 72-74: Replace the loose call-count assertion on
mocks.drizzleClient.query.usersTable.findFirst with an argument-aware assertion:
assert that mocks.drizzleClient.query.usersTable.findFirst was called with an
object containing the expected columns.role selection and the where callback
(e.g. use toHaveBeenCalledWith(expect.objectContaining({ columns:
expect.objectContaining({ role: expect.anything() }), where:
expect.any(Function) })) so the resolver's query shape/filter is validated;
apply the same change for the other occurrences that currently use
toHaveBeenCalledOnce (the other findFirst assertions noted in the comment).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: a025855a-51b8-4d52-8738-22183b77a1c3
📒 Files selected for processing (1)
test/graphql/types/User/homePhoneNumber.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/graphql/types/User/homePhoneNumber.test.ts`:
- Around line 60-201: Add a test that simulates a DB failure by having
mocks.drizzleClient.query.usersTable.findFirst.mockRejectedValue(new Error("db
error")) and asserting runResolver(parent, context) rejects; ensure the test
uses the same setup helper (createSetup) and asserts the call to
mocks.drizzleClient.query.usersTable.findFirst was made with the same options
(expect.objectContaining with columns.role and where: expect.any(Function)), so
the resolver's error path for current-user lookup is covered (referencing
runResolver, createSetup, and mocks.drizzleClient.query.usersTable.findFirst).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1f11bc8d-6359-4fff-8179-754226d78ff4
📒 Files selected for processing (1)
test/graphql/types/User/homePhoneNumber.test.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #5352 +/- ##
===========================================
+ Coverage 93.69% 95.38% +1.68%
===========================================
Files 861 909 +48
Lines 71332 78564 +7232
Branches 9893 11414 +1521
===========================================
+ Hits 66838 74942 +8104
+ Misses 4494 3622 -872
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Hi @palisadoes , |
|
@palisadoes , |
What kind of change does this PR introduce?
It adds the test for
homePhoneNumber.tsfile.Issue Number:
Fixes #5082
Summary
I had added comprehensive unit tests for
homePhoneNumber.tsGraphQL field resolver to improve code coverage. AddedhomePhoneNumber.test.tsto improve coverage and validate resolver behavior.Test Cover
Does this PR introduce a breaking change?
No.
Checklist
CodeRabbit AI Review
Test Coverage
Have you read the contributing guide?
Yes
Summary by CodeRabbit