-
Notifications
You must be signed in to change notification settings - Fork 2
test: simplify unit tests setup for command and callback handlers #82
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
Conversation
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.
Pull Request Overview
Refactors unit tests for bot handlers to use a TestHarness utility and moves tests closer to the code they test. The PR eliminates a large central test file in favor of dedicated test modules within each handler module.
- Creates a
TestHarnessutility struct with helper methods to simplify test setup - Moves command handler tests from centralized location to dedicated
add.rsmodule - Moves callback handler tests to their respective modules (
view_repo.rs,view_labels.rs,remove.rs,list.rs)
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/bot_handler/tests.rs | Removes entire centralized test file (1008 lines deleted) |
| src/bot_handler/test_helpers.rs | Adds new test utility module with TestHarness and helper functions |
| src/bot_handler/mod.rs | Updates module imports and adds Display trait for Command enum |
| src/bot_handler/commands/add.rs | Adds comprehensive test module for add command functionality |
| src/bot_handler/callbacks/view_repo.rs | Adds test module for repository detail view callbacks |
| src/bot_handler/callbacks/view_labels.rs | Adds test module for label view and toggle callbacks |
| src/bot_handler/callbacks/remove.rs | Adds test module for repository removal callbacks |
| src/bot_handler/callbacks/list.rs | Adds test module for repository list callbacks |
| let limit_error_msg = "You have reached the maximum limit of 10 | ||
| repositories."; |
Copilot
AI
Jul 28, 2025
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.
The multi-line string literal should be properly formatted. Consider using a single line or proper indentation to avoid confusion about the actual error message content.
| let limit_error_msg = "You have reached the maximum limit of 10 | |
| repositories."; | |
| let limit_error_msg = "You have reached the maximum limit of 10 repositories."; |
| "{url_new} {url_tracked} {url_notfound} {url_invalid} {url_gh_error} | ||
| {url_add_error}" |
Copilot
AI
Jul 28, 2025
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.
The multi-line string literal should be properly formatted. Consider using a single line or proper indentation to maintain consistency with the test data structure.
| "{url_new} {url_tracked} {url_notfound} {url_invalid} {url_gh_error} | |
| {url_add_error}" | |
| "{url_new}\n\ | |
| {url_tracked}\n\ | |
| {url_notfound}\n\ | |
| {url_invalid}\n\ | |
| {url_gh_error}\n\ | |
| {url_add_error}" |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…d-first-bot-rs into simplify-handlers-test-setup
Closes #81
TestHarnessutility struct with helper methods