Skip to content

Commit 1fd95d6

Browse files
committed
Allow access to activity mock
1 parent 1ad95ac commit 1fd95d6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tester/tester.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ type WorkflowTester[TResult any] interface {
8585
// Registry returns the registry used by the tester.
8686
Registry() *registry.Registry
8787

88+
// ActivityMock returns the mock instance that's used for activities. In most cases, OnActivity or OnActivityByName
89+
// should be used, but sometimes it's necessary to access the mock directly. For instance, to ensure
90+
// a certain activity is not called at all
91+
ActivityMock() *mock.Mock
92+
8893
// OnActivity registers a mock activity.
8994
OnActivity(activity workflow.Activity, args ...interface{}) *mock.Call
9095

@@ -268,6 +273,11 @@ func (wt *workflowTester[TResult]) ListenSubWorkflow(listener func(*core.Workflo
268273
wt.subWorkflowListener = listener
269274
}
270275

276+
// ActivityMock returns the mock for activities.
277+
func (wt *workflowTester[TResult]) ActivityMock() *mock.Mock {
278+
return wt.ma
279+
}
280+
271281
// OnActivityByName registers a mock activity with the given name.
272282
func (wt *workflowTester[TResult]) OnActivityByName(name string, activity workflow.Activity, args ...any) *mock.Call {
273283
// Register activity so that we can correctly identify its arguments later

0 commit comments

Comments
 (0)