-
-
Notifications
You must be signed in to change notification settings - Fork 362
test(Upload): add unit test for upload reset #6667
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
This PR adds a unit test to verify the upload reset functionality and includes minor code improvements. The primary purpose is to ensure that the Reset() method properly re-enables the upload button after it has been disabled due to file count limits.
- Adds test coverage for the upload reset functionality
- Improves code formatting and readability
- Uses compound assignment operator for better code style
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
test/UnitTest/Components/UploadButtonTest.cs | Adds unit test for upload reset functionality and converts method to async |
src/BootstrapBlazor/Components/Upload/UploadBase.cs | Refactors file count calculation using compound assignment operator |
src/BootstrapBlazor/Components/Upload/ButtonUpload.razor | Improves code formatting by splitting long line |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
🧙 Sourcery has finished reviewing your pull request! Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6667 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 739 739
Lines 31674 31674
Branches 4459 4459
=========================================
Hits 31674 31674
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `test/UnitTest/Components/UploadButtonTest.cs:89` </location>
<code_context>
[Fact]
- public void InputUpload_IsMultiple()
+ public async Task InputUpload_IsMultiple()
{
var cut = Context.RenderComponent<ButtonUpload<string>>(pb =>
</code_context>
<issue_to_address>
Consider adding assertions for error conditions and edge cases in the upload reset test.
Please add tests for cases like resetting with no files uploaded or when the upload is already enabled, and verify the uploaded files list is cleared after reset.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
var button = cut.Find(".btn-browser"); | ||
Assert.True(button.IsDisabled()); | ||
|
||
// 调用 Reset 方法 | ||
await cut.InvokeAsync(() => cut.Instance.Reset()); | ||
|
||
// 重置后上传按钮应该被启用 |
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.
suggestion (testing): Consider adding assertions for error conditions and edge cases in the upload reset test.
Please add tests for cases like resetting with no files uploaded or when the upload is already enabled, and verify the uploaded files list is cleared after reset.
Link issues
fixes #6666
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add async unit test for ButtonUpload reset functionality and apply minor code cleanups in Upload components
Enhancements:
Tests: