-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add NotBefore
function to testsuite.MockCallWrapper
#1301
Add NotBefore
function to testsuite.MockCallWrapper
#1301
Conversation
|
internal/workflow_testsuite.go
Outdated
// NotBefore indicates that a call to this mock must not happen before the given calls have happened as expected. | ||
// It calls `NotBefore` on the wrapped mock call. | ||
func (c *MockCallWrapper) NotBefore(calls ...*MockCallWrapper) *MockCallWrapper { | ||
wrappedCalls := []*mock.Call{} |
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.
Often best practice to create the slice with a certain len/cap if you know what it will be
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.
Makes sense. I've changed the code to create a slice with an initial capacity.
(will let @Quinn-With-Two-Ns review) |
Thanks! Merged main into branch, will merge into main if/when CI succeeds. |
What was changed
This PR adds a
NotBefore
method to thetestsuite.MockCallWrapper
.It indicates that a mock call must not happen before the given set of other mocks have been called as expected.
The actual functionality for this is already implemented in
github.com/stretchr/testify/mock
.The new function forwards to the
.NotBefore()
method on the wrappedmock
object.Why?
This change further improves the testability of workflows.
It allows to specify the exact sequence that activities and child-workflow executions must happen.
For example, "call activity abc, then execute child-workflow xyz"
Checklist
No issue found.
Added an additional unit test.
Go docs should update automatically.