mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
Bug 1858948 - Update ProductNotAvailable test to use initial state
This commit is contained in:
parent
af791c9629
commit
8415d6d56e
@ -1335,41 +1335,15 @@ class ReviewQualityCheckStoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `GIVEN deletedProduct is true WHEN report back in stock returns not deleted THEN state is updated to no analysis`() =
|
||||
fun `GIVEN ProductNotAvailable WHEN report back in stock returns not deleted THEN state is updated to no analysis`() =
|
||||
runTest {
|
||||
val tested = ReviewQualityCheckStore(
|
||||
middleware = provideReviewQualityCheckMiddleware(
|
||||
reviewQualityCheckPreferences = FakeReviewQualityCheckPreferences(isEnabled = true),
|
||||
reviewQualityCheckService = FakeReviewQualityCheckService(
|
||||
productAnalysis = {
|
||||
ProductAnalysisTestData.productAnalysis(
|
||||
deletedProduct = true,
|
||||
deletedProductReported = false,
|
||||
)
|
||||
},
|
||||
reanalysis = AnalysisStatusDto.PENDING,
|
||||
statusProgress = { null },
|
||||
report = ReportBackInStockStatusDto.NOT_DELETED,
|
||||
),
|
||||
networkChecker = FakeNetworkChecker(isConnected = true),
|
||||
),
|
||||
)
|
||||
tested.waitUntilIdle()
|
||||
dispatcher.scheduler.advanceUntilIdle()
|
||||
tested.waitUntilIdle()
|
||||
tested.dispatch(ReviewQualityCheckAction.FetchProductAnalysis).joinBlocking()
|
||||
tested.waitUntilIdle()
|
||||
dispatcher.scheduler.advanceUntilIdle()
|
||||
|
||||
val expected = ReviewQualityCheckState.OptedIn(
|
||||
initialState = ReviewQualityCheckState.OptedIn(
|
||||
productReviewState = ReviewQualityCheckState.OptedIn.ProductReviewState.Error.ProductNotAvailable,
|
||||
productRecommendationsPreference = false,
|
||||
productRecommendationsExposure = true,
|
||||
productVendor = ProductVendor.BEST_BUY,
|
||||
)
|
||||
assertEquals(expected, tested.state)
|
||||
|
||||
val noAnalysisTested = ReviewQualityCheckStore(
|
||||
),
|
||||
middleware = provideReviewQualityCheckMiddleware(
|
||||
reviewQualityCheckPreferences = FakeReviewQualityCheckPreferences(isEnabled = true),
|
||||
reviewQualityCheckService = FakeReviewQualityCheckService(
|
||||
@ -1387,15 +1361,20 @@ class ReviewQualityCheckStoreTest {
|
||||
networkChecker = FakeNetworkChecker(isConnected = true),
|
||||
),
|
||||
)
|
||||
|
||||
noAnalysisTested.dispatch(ReviewQualityCheckAction.ReportProductBackInStock).joinBlocking()
|
||||
noAnalysisTested.waitUntilIdle()
|
||||
tested.waitUntilIdle()
|
||||
dispatcher.scheduler.advanceUntilIdle()
|
||||
tested.waitUntilIdle()
|
||||
tested.dispatch(ReviewQualityCheckAction.ReportProductBackInStock).joinBlocking()
|
||||
tested.waitUntilIdle()
|
||||
dispatcher.scheduler.advanceUntilIdle()
|
||||
|
||||
val reportExpected = expected.copy(
|
||||
val expected = ReviewQualityCheckState.OptedIn(
|
||||
productReviewState = ProductAnalysisTestData.noAnalysisPresent(progress = -1f),
|
||||
productRecommendationsPreference = false,
|
||||
productRecommendationsExposure = true,
|
||||
productVendor = ProductVendor.BEST_BUY,
|
||||
)
|
||||
assertEquals(reportExpected, noAnalysisTested.state)
|
||||
assertEquals(expected, tested.state)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user