Package-level declarations

Types

Link copied to clipboard
typealias FakeInfiniteQueryFetch<T, S> = suspend (param: S) -> T
Link copied to clipboard

Creates a fake infinite query key that returns the result of the given mock function.

Link copied to clipboard
class FakeMutationKey<T, S>(target: MutationKey<T, S>, mock: FakeMutationMutate<T, S>) : MutationKey<T, S>

Creates a fake mutation key that returns the result of the given mock function.

Link copied to clipboard
typealias FakeMutationMutate<T, S> = suspend (variable: S) -> T
Link copied to clipboard
typealias FakeQueryFetch<T> = suspend () -> T
Link copied to clipboard
class FakeQueryKey<T>(target: QueryKey<T>, mock: FakeQueryFetch<T>) : QueryKey<T>

Creates a fake query key that returns the result of the given mock function.

Link copied to clipboard

Creates a fake subscription key that returns the result of the given mock function.

Link copied to clipboard
typealias FakeSubscriptionSubscribe<T> = () -> Flow<T>
Link copied to clipboard

This extended interface of the SwrClient provides the capability to mock specific queries and mutations for the purpose of testing. By registering certain keys as mocks, you can control the behavior of these specific keys while the rest of the keys function normally. This allows for more targeted and precise testing of your application.

Link copied to clipboard

This extended interface of the SwrClientPlus provides the capability to mock specific queries, mutations, and subscriptions for the purpose of testing. By registering certain keys as mocks, you can control the behavior of these specific keys while the rest of the keys function normally. This allows for more targeted and precise testing of your application.

Functions

Link copied to clipboard
fun SwrClient.test(initializer: TestSwrClient.() -> Unit = {}): TestSwrClient

Switches SwrClient to a test interface.

Link copied to clipboard

Switches SwrClientPlus to a test interface.