realize
realize copied to clipboard
Unit test, mock exec command in a smart way
Missing unit test for some files. We should find a way to make a specific mock for exec.Command. In this case, channels are involved and there are multiple answers to consider. A classic exec.Command mock doesn't seem right.
One solution doesn't fit all. But mocking based on where the code flow is happening makes sense. exec.command is being used here. An interface that can execute the commands and implementing a mock struct of the interface is a good option.
I can help with it. External mock libraries can be used?
yes, this isn't a problem