At present we are not explicitly exporting the Mock version of HTTPoison in our Hex package.
Which means that the we need to have a Mock implementation in each "consumer" project.
See: https://github.com/dwyl/auth-mvp/blob/9836d31b501a731fcedfdd8a0d4fe026d105bda2/lib/mock/elixir_auth_google.ex#L1-L27
I propose that we take this a step further and actually check the MIX_ENV in the elixir-auth-google package and if MIX_ENV=test we return the Mock version of the functions.
e.g: https://github.com/dwyl/elixir-auth-google/blob/master/lib/httpoison/in_memory.ex
This way the person using the package never has to think about creating their own mocks and simply copy-paste the sample tests to achieve 100% test coverage in their project.
I don't know if this is an "anti pattern" or a "best practice" so I've opened a question to find out:
https://softwareengineering.stackexchange.com/questions/408267/is-it-a-best-practice-or-anti-pattern-to-export-mock-versions-of-functions-for-a

Asking questions is the only way to learn. If you aren't asking questions you aren't learning.
I think I want to export the Mocks regardless of what other people say - because I don't want to have to duplicate this code in the Auth project - but I'm curious what the "best practice" is.
At present we are not explicitly exporting the Mock version of HTTPoison in our Hex package.
Which means that the we need to have a Mock implementation in each "consumer" project.
See: https://github.com/dwyl/auth-mvp/blob/9836d31b501a731fcedfdd8a0d4fe026d105bda2/lib/mock/elixir_auth_google.ex#L1-L27
I propose that we take this a step further and actually check the
MIX_ENVin theelixir-auth-googlepackage and ifMIX_ENV=testwe return the Mock version of the functions.e.g: https://github.com/dwyl/elixir-auth-google/blob/master/lib/httpoison/in_memory.ex
This way the person using the package never has to think about creating their own mocks and simply copy-paste the sample tests to achieve 100% test coverage in their project.
I don't know if this is an "anti pattern" or a "best practice" so I've opened a question to find out:

https://softwareengineering.stackexchange.com/questions/408267/is-it-a-best-practice-or-anti-pattern-to-export-mock-versions-of-functions-for-a
I think I want to export the Mocks regardless of what other people say - because I don't want to have to duplicate this code in the Auth project - but I'm curious what the "best practice" is.