Vapor 3 has a very interesting dependency injection framework which will help you manage dependencies and mock them inside your tests.
Testing controllers with external dependencies, especially ones involving HTTP requests, is very tricky. That’s because sending actual requests would create a test that you could not rely on and is very slow. In this blog post I’m trying to explain how to test controllers by mocking dependencies in Vapor 3.
When I recently tried to use ImageMagick in my Vapor project, I spent a couple of hours trying to figure out how to setup and wrap ImageMagick into a Swift package. I had a lot of issues with missing files and linker errors. After resolving all of those issues, using ImageMagick turns out to be very simple and straightforward 😄