I have a module with several public api and the implementation for these public require call to several private functions. Something like this
def foo do bar baa baz end defp baa do ... end defp baz do ... end defp bar do ..... end
And baa have 2 cases to test, baz have 3 cases, and bar have 5 cases. So if I just keep them as private functions inside 1 module, I need to write 2x3x5=30 unit tests.
So I refactor them to separate module and make them public so I just need to write 2+3+5=10 unit tests and some smoke tests for foo which don’t cover all the scenarios.
Is that approach ok and how I prevent users from misused my private module ? I just want the user to use my public module only.
Hope to hear your thoughts on this matter. Thanks