NetworkMock
NetworkMock module — manages network request/response mocking for development and testing.
Implements RequiresDataStore so that com.worldline.devview.core.rememberModules automatically initialises the shared NetworkMockDataStoreDelegate before initModule is called.
The dataStoreDelegate points to NetworkMockDataStoreDelegate — the process-level singleton declared in devview-networkmock-core. This ensures that both this UI module and devview-networkmock-ktor share exactly one DataStore instance without depending on each other.
initModule passes the initialised DataStore explicitly to NetworkMockInitializer.initialize, which constructs MockStateRepository and MockConfigRepository once for the lifetime of the process.
Usage
val modules = rememberModules {
module(NetworkMock(
resourceLoader = { path -> Res.readBytes(path) }
))
}The Ktor plugin requires no configuration when NetworkMock is registered:
val client = HttpClient(OkHttp) {
install(NetworkMockPlugin)
}Properties
Points to NetworkMockDataStoreDelegate — the process-level singleton in devview-networkmock-core. Both this module and devview-networkmock-ktor reference the same delegate, guaranteeing a single DataStore instance.
Functions
Initialises the network mock repositories once the DataStore is ready.