Test shared() async results against #[On] listeners - #484
Merged
Merged
Conversation
The existing shared() test used an ->on() closure listener, which gets the whole payload as one object. #[On] methods bind payload keys to parameter names instead, so that path had no coverage. A handler written as syncComplete($event) broke on device because no payload key is called event. Add two tests that send a shared() result to a real #[On] method, one for a finished task and one for a failed one. The failure payload has no result key, which is why every parameter needs a default. Also mention the name binding in the Boost docs index. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
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.
Follow-up to #228. These were written while #228 was open but weren't pushed before it merged.
Testing
shared()in the super-native demo app crashed the screen. The demo's#[On]handler took a single$eventargument. But#[On]methods get payload keys bound to their parameter names, and theshared()payload hasid,resultandstatuskeys. There is noeventkey, so the call failed. The framework was right. The demo and the docs page had the wrong signature.The existing
shared()test didn't catch it because it used an->on()closure listener, and closures get the whole payload as one object.This adds two tests that send a
shared()result to a real#[On]method, one for a finished task and one for a failed one. The failure payload has noresultkey, so that test also shows why every parameter needs a default. The Boost docs index now mentions the name binding too.One thing that changed since #228:
#[On]calls now go throughComponentMethodInvoker, so a$eventhandler fails with aBindingResolutionExceptioninstead of theArgumentCountErrorwe saw on device. I checked that both new tests fail with the bad signature.No source changes. Full suite passes locally (1165 tests).
🤖 Generated with Claude Code