test(gmail): add unit tests for +triage argument parsing#445
Conversation
triage.rs was the only helper file with zero test coverage. Add tests for: default max (20), explicit max, non-numeric max fallback, custom query, labels flag, and output format selection.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness of the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🦋 Changeset detectedLatest commit: 84cdd27 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Code Review
This pull request adds valuable unit tests for the gmail +triage argument parsing. However, the current implementation duplicates the parsing logic from the production code within the tests, which makes them brittle. I've provided a suggestion to refactor the tests to centralize this logic, making them cleaner and more maintainable. This also highlights an opportunity to make the production code more testable by extracting the argument parsing logic.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #445 +/- ##
==========================================
+ Coverage 67.22% 67.39% +0.16%
==========================================
Files 38 38
Lines 16679 16764 +85
==========================================
+ Hits 11213 11298 +85
Misses 5466 5466 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
gmail +triageargument parsing — previously the only helper file with zero test coverage--max,--queryoverride,--labelsflag, and--formatselectionDetails
src/helpers/gmail/triage.rshad no#[cfg(test)]module. While the core logic involves network calls (Gmail API), the argument parsing and format selection are purely deterministic and worth covering.Tests added
defaults_max_to_20_and_query_to_unread— verifies default valuesexplicit_max_overrides_default—--max 5parses correctlynon_numeric_max_falls_back_to_20—--max abcsilently falls backcustom_query_overrides_default—--query 'from:boss'workslabels_flag_defaults_to_false— default behaviorlabels_flag_set_when_passed—--labelssets the flagformat_defaults_to_table_when_absent— table is the defaultformat_json_when_specified—--format jsonswitches output