Package com.apollographql.apollo3.testing

Types

Link copied to clipboard
Link copied to clipboard
class MockServerTest(    val mockServer: MockServer,     val apolloClient: ApolloClient,     val scope: CoroutineScope)
Link copied to clipboard
Link copied to clipboard
class TestTokenProvider(currentAccessToken: String, val newAccessToken: String) : TokenProvider

Functions

Link copied to clipboard
fun checkFile(actualText: String, path: String)

Checks that actualText matches the contents of the file at path

Link copied to clipboard
fun cwd(): String
Link copied to clipboard
fun <D : Operation.Data> MockServer.enqueue(    operation: Operation<D>,     data: D,     customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty,     delayMs: Long = 0)
Link copied to clipboard
fun MockServer.enqueueData(    data: Operation.Data,     customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty,     delayMs: Long = 0,     statusCode: Int = 200)
fun MockServer.enqueueData(    data: Map<String, Any?>,     customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty,     delayMs: Long = 0,     statusCode: Int = 200)
Link copied to clipboard
Link copied to clipboard
fun <D : Operation.Data> ApolloClient.enqueueTestResponse(response: ApolloResponse<D>)
fun <D : Operation.Data> ApolloClient.enqueueTestResponse(    operation: Operation<D>,     data: D? = null,     errors: List<Error>? = null)
Link copied to clipboard
fun mockServerTest(block: suspend MockServerTest.() -> Unit)

A convenience function that makes sure the MockServer and ApolloClient are properly closed at the end of the test

Link copied to clipboard
fun pathToJsonReader(path: String): JsonReader
Link copied to clipboard
fun pathToUtf8(path: String): String
Link copied to clipboard
suspend fun <T> Channel<T>.receiveOrTimeout(timeoutMillis: Long = 500): T
Link copied to clipboard
fun <D : Operation.Data> ApolloClient.registerTestNetworkError(operation: Operation<D>)
Link copied to clipboard
fun <D : Operation.Data> ApolloClient.registerTestResponse(operation: Operation<D>, response: ApolloResponse<D>)
fun <D : Operation.Data> ApolloClient.registerTestResponse(    operation: Operation<D>,     data: D? = null,     errors: List<Error>? = null)
Link copied to clipboard
fun runTest(    context: CoroutineContext = EmptyCoroutineContext,     before: suspend CoroutineScope.() -> Unit = {},     after: suspend CoroutineScope.() -> Unit = {},     block: suspend CoroutineScope.() -> Unit)
Link copied to clipboard
actual fun shouldUpdateTestFixtures(): Boolean
expect fun shouldUpdateTestFixtures(): Boolean
actual fun shouldUpdateTestFixtures(): Boolean
actual fun shouldUpdateTestFixtures(): Boolean

Properties

Link copied to clipboard
actual val HostFileSystem: FileSystem
expect val HostFileSystem: FileSystem

The host filesystem

actual val HostFileSystem: FileSystem
actual val HostFileSystem: FileSystem
Link copied to clipboard
actual val testsPath: String
expect val testsPath: String

The path to the "tests" directory. This assumes all tests are run from a predictable place relative to "tests" We need this for JS tests where the CWD is not properly set at the beginning of tests

actual val testsPath: String
actual val testsPath: String