InfiniteQueryTestTag
TestTag implementation for InfiniteQuery operations that provides tag-based identification.
This class is used to identify infinite queries for mocking in test and preview environments, particularly when dealing with auto-generated query IDs that may change during configuration changes or recompositions.
Unlike InfiniteQueryId which might use auto-generated values that can change across recompositions, InfiniteQueryTestTag provides a stable identifier that can be consistently referenced in tests and previews.
Usage example:
// Define a test tag
class UserListQueryTestTag : InfiniteQueryTestTag<User, PageParams>("user-list")
// Use with test client
testClient.on(UserListQueryTestTag()) { QueryState.success(mockUserChunks) }
// Apply when getting an infinite query
val query = client.getInfiniteQuery(queryKey, Marker.testTag(UserListQueryTestTag()))
Content copied to clipboard
Parameters
T
The type of data that will be returned by the infinite query
S
The type of pagination parameters for loading more data
tag
A unique string identifier for this test tag