Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

added unit tests for limited result

Hasib Prince requested to merge 1577-unit_test_limited_result into main

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.

Issues

backlog/-/issues/1577

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/mobile-team/guidelines/Code-review

Merge request reports

Loading