Skip to content

Mocking support

Compare
Choose a tag to compare
@HT808s HT808s released this 07 Apr 14:33

We introduced mocking for the Mailjet driver

This change was aimed at improving the testability of the driver and so it comes with new unit tests based on these mocks

Here is how it works,
The driver is composed of several structs each having their own distinct functional scope

All the driver features are accessible from an instance of mailjet_client

Underneath it there are two major components that fuels these features

If you simply want to keep using the driver, you still can like you used to

However, if you want/need to do unit tests that involves the driver, here is how you can instantiate the driver to inject the HTTP and SMTP clients you need to make that happen

You may inject the HTTP and SMTP mocks available in this repository or you can also use your own as long as they respect the interfaces