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
Make verifyAction and verifyActionResult support no processed action. #909
Conversation
/** | ||
* Asserts that the render pass either didn't result in any [WorkflowAction] being performed | ||
* (e.g. in the case where a rendering event is disabled by being mapped to a no-op), or that | ||
* an action was performed that didn't change the state or emit an output. |
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.
Is this too lenient? Should this method require no action to have been processed at all? The current behavior could let through an action that has complex logic that just happens to set the state to it's previous value.
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.
My knee-jerk is that a literal "no action was fired" assertion is too much of an implementation detail to encourage in testing. But the real question is whether this satisfies the original requester.
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.
An alternative is to allow verifyActionResult
to handle the case where no action was fired and just treat it like a no-op action, but that raises the same concern about actions that "just happen" to be no-op.
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.
So the original use case I had in mind for this was verifying the following behavior:
- User has entered invalid data into a simple form
- User presses the submit button
- Ensure that no network request was made to actually submit the data
The motivation for this test was to ensure that I'm being properly defensive against the UI not respecting the data validity flag in the state and leaving the submit button enabled. I want to make sure that the lambda I'm handing to the UI to fire when the submit button is clicked is actually a no-op.
I agree that actions are implementation details and I don't want to expose them outside of the workflow, but I think allowing no-op actions might open up some gaps in a test like the one I'm trying to write.
45bd2c8
to
1ba13b2
Compare
Reworked this PR: no more |
Still LG. |
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.
Sweet!
Closes #885.
cc @ijwhelan