refactor(grails-data-graphql): honor explicit mergedField in MockDataFetchingEnvironment - #16206
Open
borinquenkid wants to merge 1 commit into
Open
Conversation
getMergedField() always rebuilt a MergedField from `fields`, ignoring the settable `mergedField` property entirely - it was never read anywhere. Fall back to building from fields only when mergedField isn't set, so test authors can stub a MergedField directly (e.g. one with a custom name/alias that the fields-list constructor path can't express) instead of only being able to set it indirectly via fields. Added MockDataFetchingEnvironmentSpec, the first dedicated spec for this public testing utility, covering both the fields-derived default and the explicit-mergedField override. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 task
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## test/grails-data-graphql-coverage #16206 +/- ##
===========================================================================
+ Coverage 53.4149% 53.4199% +0.0050%
- Complexity 19459 19460 +1
===========================================================================
Files 2081 2081
Lines 98993 98993
Branches 17361 17361
===========================================================================
+ Hits 52877 52882 +5
+ Misses 38566 38562 -4
+ Partials 7550 7549 -1 🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: b4c7b5c Learn more about TestLens at testlens.app/docs. |
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.
Summary
Stacked on #16201.
MockDataFetchingEnvironment#getMergedField()always rebuilt aMergedFieldfromfields, ignoring the settablemergedFieldproperty entirely - it was flagged as unused. Now falls back to building fromfieldsonly whenmergedFieldisn't explicitly set, so test authors can stub aMergedFielddirectly. AddsMockDataFetchingEnvironmentSpec, the first dedicated spec for this public testing utility.Test plan
./gradlew :grails-data-graphql-core:test :grails-data-graphql:test :grails-data-graphql-core:codeStyle :grails-data-graphql:codeStylepasses🤖 Generated with Claude Code