test: Refactor and tests Sourcemap command#26
Merged
miquelbeltran merged 7 commits intomainfrom Jun 26, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the sourcemap command infrastructure to support dependency injection and return values, replaces manual multipart request construction with a RaygunMultipartRequestBuilder, and adds unit tests (with generated Mockito mocks) for both the sourcemap and symbols features to increase CLI test coverage.
- Refactored
SourcemapCommand,SourcemapBase, and related classes to accept an injectedSourcemapApiand returnboolinstead of callingexitdirectly. - Replaced manual
http.MultipartRequestcode inSourcemapApiwith a builder pattern (RaygunMultipartRequestBuilder) and updated the upload logic. - Added comprehensive unit tests under
test/sourcemapsand updated/generated mocks; updated symbols mocks to point to the correct test path.
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/symbols/symbols_command_test.mocks.dart | Updated import prefixes and mock class references. |
| test/symbols/symbols_api_test.mocks.dart | Corrected test path in generated mock header. |
| test/sourcemaps/sourcemap_command_test.mocks.dart | Added generated mocks for SourcemapCommand. |
| test/sourcemaps/sourcemap_command_test.dart | New tests for single-file, flutter, node, unsupported, and help cases. |
| test/sourcemaps/sourcemap_api_test.mocks.dart | Added generated mocks for http.Client. |
| test/sourcemaps/sourcemap_api_test.dart | New tests for SourcemapApi.uploadSourcemap success, failure, and missing file cases. |
| lib/src/symbols/symbols_command.dart | Renamed parser method calls from buildParserSymbols to buildParser. |
| lib/src/sourcemap/sourcemap_single_file.dart | Changed upload() return type to Future<bool> and injected api. |
| lib/src/sourcemap/sourcemap_command.dart | Converted to a RaygunCommand subclass with DI and a run method returning bool. |
| lib/src/sourcemap/sourcemap_base.dart | Added api field and changed upload() signature to Future<bool>. |
| lib/src/sourcemap/sourcemap_api.dart | Swapped in RaygunMultipartRequestBuilder, cleaned up multipart logic. |
| lib/src/sourcemap/node/sourcemap_node.dart | Changed upload() to return bool and injected api. |
| lib/src/sourcemap/flutter/sourcemap_flutter.dart | Changed upload() to return bool and injected api. |
| lib/src/core/raygun_command.dart | Simplified abstract interface to only execute and buildParser. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test: Refactor and tests Sourcemap command
Description 📝
Type of change
Updates
Test plan 🧪
Author to check 👓
Reviewer to check ✔️