-
-
Notifications
You must be signed in to change notification settings - Fork 486
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
Unit test event service #2673
Unit test event service #2673
Conversation
WalkthroughThe pull request introduces a new getter method Changes
Sequence DiagramsequenceDiagram
participant Client
participant EventService
participant OrgStream
Client->>EventService: Request current organization
EventService->>OrgStream: Get current org info
OrgStream-->>EventService: Return OrgInfo
EventService-->>Client: Provide current organization details
Possibly related PRs
Suggested reviewers
Poem
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:
Other🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2673 +/- ##
====================================================
+ Coverage 95.98% 96.08% +0.10%
====================================================
Files 187 187
Lines 9887 9892 +5
====================================================
+ Hits 9490 9505 +15
+ Misses 397 387 -10 ☔ 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.
@coderabbitai review
@MohitMaulekhi Please make sure coderabbit reviews your PR and any comments it has are addressed. Please do not assign reviewers. |
Please make coderabbit.ai approve your changes |
@coderabbitai review |
✅ Actions performedReview triggered.
|
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)
lib/services/event_service.dart (1)
56-63
: Ensure doc comments match the returned entity.
The doc comment references an "event stream," but this new getter returnsOrgInfo
. Update the comment to accurately reflect its purpose.test/service_tests/event_service_test.dart (1)
677-768
: Consider assertions to validate returned event objects.
The debug prints are helpful, but including assertions on the event data (e.g., title fields) would make these tests more robust and guard against regressions.- print(events); - // ... - // expect(events, isA<List<Event>>()); - // expect(events.length, 2); - // expect(events[0].title, "Test Event 1"); - // expect(events[1].title, "Test Event 2"); + expect(events, isA<List<Event>>()); + expect(events.length, 2); + expect(events[0].title, "Test Event 1"); + expect(events[1].title, "Test Event 2");
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
lib/services/event_service.dart
(1 hunks)test/service_tests/event_service_test.dart
(5 hunks)
🔇 Additional comments (3)
test/service_tests/event_service_test.dart (3)
Line range hint 420-482
: Great test coverage for volunteer groups.
The new tests correctly validate both the success and failure scenarios of fetchVolunteerGroupsByEvent
. This ensures robust coverage for edge cases.
639-653
: Good verification of organization updates in the stream.
This test effectively ensures that _currentOrg
is updated whenever setOrgStreamSubscription
emits a new organization object.
655-675
: Validate exception handling for null data.
The test successfully checks that fetchDataFromApi
throws an exception when the query returns null
data, increasing code resilience.
@noman2002 PTAL |
e771527
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
Unit test for Event service
Issue Number:
Fixes #2616
Did you add tests for your changes?
Yes
Snapshots/Videos:
Summary
This PR aims to increase the code coverage of the specified file by adding comprehensive unit tests. It ensures that all methods, functions, and widgets are thoroughly tested, improving the overall reliability and maintainability of the codebase. The Pr will resolve issue #2616.
Does this PR introduce a breaking change?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit
New Features
Bug Fixes
Tests