...

/

Testing ProductCacheRepository

Testing ProductCacheRepository

Look at the methods to test the interaction between the PostgreSQL implementation of ProductCacheRepository and PostgreSQL.

We will use all of the aforementioned methods to test the interaction between the PostgreSQL implementation of ProductCacheRepository and PostgreSQL:

Press + to interact
The integration test for ProductCacheRepository
The integration test for ProductCacheRepository

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 ...