DEV Community

Discussion on: Mocking Methods in Go

Collapse
 
aronhoyer profile image
Aron Høyer

I'm a bit confused. If you mock a function or method, and test that mock, how can we then say that the test is a test of the original function or method? You're essentially testing the mock, and not the original function or method, no?

Collapse
 
rogiervandoggenaar profile image
R.V. van Doggenaar

He is not testing the mock, he is testing the GetVolumeAndArea function, he just mocks the two functions inside, as he probably has seperate tests for those functions

Collapse
 
aronhoyer profile image
Aron Høyer

thanks for clearing that up 😅

Thread Thread
 
rogiervandoggenaar profile image
R.V. van Doggenaar

haha, it's been lingering there for a while... I stumbled upon it during my own search for answers. I thought I'd let you know.