Workiva / state_machine

Easily create a finite state machine and define legal state transitions. Listen to state entrances, departures, and transitions.
Other
61 stars 24 forks source link

Expose StateTransition canCall method #58

Closed lidio601 closed 4 years ago

lidio601 commented 4 years ago

Motivation

Similar #57 but for a different task.

What I'm trying to achieve is to have a test function that allows me to check whenever a transition is feasible in an arbitrary state.

Imagine if you're trying to model light on/off switch. your UI needs a method to check whenever the on or off action is available to eventually disable the related button.

Changes

I just exposed the StateTransition.call pre-checks into a separate method named canCall which would allow achieving the above.

I also thought about merging this code with the same checks in the call method but I didn't want to conflict with #57

Release Notes

Exported the StateTransition canCall method

Review

See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.

Please review:

QA Checklist

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

aviary2-wf commented 4 years ago

Security Insights

No security relevant content was detected by automated scans.

Action Items

maxwellpeterson-wf commented 4 years ago

@evanweible-wf FYI