John O'Reilly
06/02/2024, 4:22 PMMockServer
based tests in StarWars KMP sample (https://github.com/joreilly/StarWars) .....I hadn't included in GH actions etc and only noticed the other day they were failing. Could perhaps have been some API changes in meantime. This is one of tests I have in case anything jumps out...getting No more responses in queue
error when repo.people.first()
is invoked
@Test
fun testStarWarsRepository() = runTest {
mockServerUrl = mockServer.url()
mockServer.enqueue(MockResponse.Builder().body(getAllPeopleMockResponse.toResponseJson()).build())
val people = repo.people.first()
assertEquals(2, people.size)
assertEquals("Person 1", people[0].name)
assertEquals("Home World 1", people[0].homeworld.name)
}
along with
private fun createMockApolloClient(url: String): ApolloClient {
return ApolloClient.Builder()
.serverUrl(url)
.build()
}
John O'Reilly
06/02/2024, 4:25 PMJohn O'Reilly
06/02/2024, 4:30 PM4.0.0-beta.6
John O'Reilly
06/02/2024, 4:37 PMMockServer
I can see following returning my mock response
val response = handler.handle(request)
mbonnin
06/02/2024, 4:49 PM.watch()
without configuring a normalized cachembonnin
06/02/2024, 4:49 PM.normalizedCache(MemoryCacheFactory())
to your ApolloClient.BuilderJohn O'Reilly
06/02/2024, 4:49 PMmbonnin
06/02/2024, 4:49 PM.execute()
)John O'Reilly
06/02/2024, 4:51 PM