Given this struct and function:
type ExampleModule struct {
DB *database.Store
AnotherModule AnotherModuleInterface
}
func(m *ExampleModule) A (i int, id int[]) error{
err := m.AnotherModuke.SomeFunc(i, id)
}
How can I make a unit test to make sure that SomeFunc
is called when I run the function A
?
testify
.AssertExpectations
can help youhttps://github.com/stretchr/testify#mock-package