Integration Tests
Explore how to write integration tests for Scala HTTP API services, focusing on pure functional programming. Understand testing techniques for FlywayDatabaseMigrator and repository implementations using Doobie, and how to verify database operations effectively.
We'll cover the following...
We'll cover the following...
Testing the FlywayDatabaseMigrator
To verify the basic behavior of our FlywayDatabaseMigrator, we write a simple test.
We construct an invalid database configuration within this test and expect that the call to migrate throws an exception. Review lines 3–8. If you remember, we had this issue already and chose not to handle any exceptions but let the calling site do this, for example, via a MonadError instance.
The other two tests are also quite simple: we just expect them to return either zero or the ...