Testing ProductCacheRepository
Look at the methods to test the interaction between the PostgreSQL implementation of ProductCacheRepository and PostgreSQL.
We'll cover the following...
We will use all of the aforementioned methods to test the interaction between the PostgreSQL implementation of ProductCacheRepository
and PostgreSQL:
This implementation uses a connection to the database and also has a dependency on the ProductRepository
interface. In the application, this is implemented as a gRPC client, which will fetch a Product
instance when we cannot find it in the database. For this integration test, that dependency will be mocked. Before we write our first test, we need to configure the suite so that our tests can use a real database and still be isolated from each other.
Suite composition
Inside the productCacheSuite
struct, we will add the following ...