Last active
July 25, 2022 13:41
-
-
Save Raiden18/7e0a7d45db9b94dc80495cf25d3c4985 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `Should show search button when internet connection is reappeared`() { | |
val testInternetConnectionEmitter = TestObservableEmitter(true) | |
val viewModel = ViewModelBuilder() | |
.withFilters(filters) | |
.withPriceNotifications(priceNotifications) | |
.withInternetConnectionStatusEmitter(testInternetConnectionEmitter) | |
.withIgnoringCallingStatesWithViewModelIsCreated() | |
.build() | |
Cases(viewModel) | |
.internetConnectionDisappeared(testInternetConnectionEmitter) | |
.userHidesSearch() | |
.internetConnectionAppeared(testInternetConnectionEmitter) | |
.forgetScreenStateCalling() | |
.userClicksOnRetryButton() | |
assertThat(screenState) | |
.showedSearchButton() | |
} | |
@Test | |
fun `Should search items after reappearing internet connection`() { | |
val testInternetConnectionEmitter = TestObservableEmitter(true) | |
val viewModel = ViewModelBuilder() | |
.withFilters(filters) | |
.withPriceNotifications(priceNotifications) | |
.withInternetConnectionStatusEmitter(testInternetConnectionEmitter) | |
.withIgnoringCallingStatesWithViewModelIsCreated() | |
.build() | |
Cases(viewModel) | |
.userSearchesFor("Apple") | |
.internetConnectionDisappeared(testInternetConnectionEmitter) | |
.userHidesSearchView() | |
.internetConnectionAppeared(testInternetConnectionEmitter) | |
.userClicksOnRetryButton() | |
.forgetScreenStateCalling() | |
.userSearchesFor("Apple") | |
assertThat(screenState) | |
.showedNotificationsForFilter( | |
filters = filters, | |
currentSelectedFilter = PriceNotificationsFilter.Active, | |
priceNotification = activePriceNotifications, | |
exactly = 1 | |
) | |
.didNotShowUnknownErrorState() | |
.didNotShowLoadingState() | |
.didNotShowNoNotificationsAtAll() | |
.didNotShowNoInternetErrorState() | |
.didNotShowShowNotificationsForFilterState() | |
.didNotShowNoNotificationsForSearch() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment