I’m creating a client for a REST API that has thorough documentation online. I read this article and this seemed like a good approach for me to test my client end-to-end. TL;DR; Spin up a cowboy web server only in the test env to mock out the API server instead of hitting the actual API endpoint during test. The API in question has examples of data to be sent/received and I’d like to use these examples for the test cases in my client so newcomers have a better idea how to use it.
However, rolling a mock server with all this data (there are many endpoints with complex data structures) has created a large folder (which I’ve called
mock) in the main
lib directory of my project. I don’t like that these files are contained here since this will make the client, when downloaded as a dependency, unnecessarily large since it contains all the mock data.
Is there a best practice for structuring projects with this behavior? I’m having trouble thinking of a way to contain all of the mock server information in the
test directory while still including it in supervision tree of the application during test.