Testing: Don't Require mock.Anything for context.Context parameter

When executing activities, I believe context.Context can be omitted as an argument since that’s propagated. However, when mocking activities - it appears that it is required to pass in mock.Anything. Failure to do so results in a mismatched mock of the registered activities.

It would be nice to not have to pass in mock.Anything for the context argument, but not sure if the requirement of it was intentional.

Sounds like a good idea. Would you file an issue against Go SDK to get this fixed. Or you can submit a pull request with the fix if you want to contribute.

I’ve added this to the Go-SDK issues.

1 Like

You can use mock.AnythingOfType() for it, or

var MockContext = mock.MatchedBy(func(c context.Context) bool { return true })