4 months ago

Writing a mock api for Algolia testing (ideas and feedback needed)

Posted 4 months ago by Reached

I am writing a bunch of tests to gain more confidence in my codebase. The tests work fine, but as part of the app there is a call that is made with Scout to Algolia and it returns some geobased results. After searching I haven't found a good way to test this behavior, so I was thinking about mocking up the API results from Algolia and then testing against that instead.

My concern is that potentially this will be very brittle, and I am unsure of whether or not it will actually serve my purpose or not.

Does anyone have any experience doing this or something similar? I am not looking for a solution, just some good ideas/advice I guess, my own solution would be to write a class with some different methods depending on what query parameters are sent with the "request".

Thanks in advance!

Please sign in or create an account to participate in this conversation.