I have some Apollo Kotlin `MockServer` based tests...
# apollo-kotlin
j
I have some Apollo Kotlin
MockServer
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
Copy code
@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
Copy code
private fun createMockApolloClient(url: String): ApolloClient {
    return ApolloClient.Builder()
        .serverUrl(url)
        .build()
}
using v
4.0.0-beta.6
hmm, if I step in to
MockServer
I can see following returning my mock response
Copy code
val response = handler.handle(request)
m
You’re calling
.watch()
without configuring a normalized cache
Add
.normalizedCache(MemoryCacheFactory())
to your ApolloClient.Builder
j
ah, cool, thanks
m
(or call
.execute()
)
j
working now, thanks
🙌 1