Package-level declarations

Types

Link copied to clipboard

Base class for test queries. Note we can't make FooOperation extend both Query and Subscription because that confuses ApolloClient when deciding whant NetworkTransport to use.

Link copied to clipboard

FooQuery is a query for tests that doesn't require codegen.

Link copied to clipboard

FooSubscription is a query for tests that doesn't require codegen.

Link copied to clipboard
class MockServerTest(val mockServer: MockServer, val apolloClient: ApolloClient, val scope: CoroutineScope)
Link copied to clipboard
class MockServerWebSocketTest(val apolloClient: ApolloClient, mockServer: MockServer, val coroutineScope: CoroutineScope)

Properties

Link copied to clipboard
expect val HostFileSystem: FileSystem

The host filesystem

actual val HostFileSystem: FileSystem

The host filesystem

actual val HostFileSystem: FileSystem
actual val HostFileSystem: FileSystem

The host filesystem

Link copied to clipboard
actual 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

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

Functions

Link copied to clipboard
suspend fun <T> Channel<T>.assertNoElement(timeoutMillis: Long = 300)
Link copied to clipboard

Extracts the operationId from a graphql-ws message, ignores "complete messages"

Link copied to clipboard
suspend fun <T> Channel<T>.awaitElement(timeoutMillis: Long = 30000): T
Link copied to clipboard
suspend fun WebsocketMockRequest.awaitSubscribe(timeout: Duration = 1.seconds, messagesToIgnore: Set<String> = emptySet()): String

Extracts the operationId from a graphql-ws message

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, delayMillis: Long = 0, statusCode: Int = 200)
fun MockServer.enqueueData(data: Map<String, Any?>, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, delayMillis: Long = 0, statusCode: Int = 200)
Link copied to clipboard
fun mockServerTest(skipDelays: Boolean = true, clientBuilder: ApolloClient.Builder.() -> Unit = {}, block: suspend MockServerTest.() -> Unit): ApolloTestResult

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard