added unit tests for limited result
Description
Added unit tests for limited results from gplay.
Note: Here, Limited result means, Sometimes Google Play returns fewer data than expected. In this case, Homepage shows fewer results than expected and search result doesn't show any result. When token is refreshed, app can fetch data as expected.
Technical Details
If app lounge can find the case of limited result, then token is refreshed. And the request of refreshing token is triggered by an Event Bus (It works like Broadcast Receiver to observe any event, Here, It actually uses a singleton Flow) mechanism. Example:
object EventBus {
private val _events = MutableSharedFlow<AppEvent>()
val events = _events.asSharedFlow()
suspend fun invokeEvent(event: AppEvent) = _events.emit(event)
}
This is how event bus is triggered:
EventBus.invokeEvent(
AppEvent.InvalidAuthEvent(AuthObject.GPlayAuth::class.java.simpleName)
)
Here, Unit testing is operated by checking the availability of any event for EventBus.