Colton Idle
02/25/2023, 6:09 PMmbonnin
02/25/2023, 6:10 PMmbonnin
02/25/2023, 6:11 PMColton Idle
02/25/2023, 6:59 PMmbonnin
02/25/2023, 6:59 PMEduard BoloČ™
02/27/2023, 12:04 PMRepository, and then we have two implementations, a RealRepository with an ApolloClient that is set up for production, and for testing we have a FakeRepository, that also has an ApolloClient more apt for testing (in-memory cache only and Dispatchers.Main.immediate dispatcher), but it also stores a map of Class<out Operation<*>> to FakeRepository.(Operation<*>) -> Operation.Data which we use for instrumentation. Here we use data builders to construct different responses in our tests. With this set up, we don't need to write and maintain JSON files, nor having to use a slow mock web server.
Sharing in case it helps others for inspiration.Colton Idle
02/27/2023, 2:20 PM