Skip to content

Commit

Permalink
[#3919] Add test for order of calls after currency change and the con…
Browse files Browse the repository at this point in the history
…version calculation
  • Loading branch information
mustafaozhan committed Sep 14, 2024
1 parent 821d445 commit 932f8c8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,12 @@ internal class CalculatorViewModelTest {
@Test
fun `when base changed the values in the list should be recalculated according to the new base and prettied`() =
runTest {
val input = "1000"
viewModel.state.onSubscription {
viewModel.event.onKeyPress("1000")
viewModel.event.onKeyPress(input)
}.firstOrNull().let {
assertNotNull(it)
assertEquals("1000", it.input)
assertEquals(input, it.input)
assertEquals("1 000", it.output)
assertEquals(currency1.symbol, it.symbol)
assertEquals(currency1.code, it.base)
Expand All @@ -328,7 +329,7 @@ internal class CalculatorViewModelTest {
currencyDataSource.getCurrencyByCode(currency1.code)
analyticsManager.trackEvent(Event.BaseChange(Param.Base(currency1.code)))
analyticsManager.setUserProperty(UserProperty.BaseCurrency(currency1.code))
calculationStorage.lastInput = "1000"
calculationStorage.lastInput = input
}
}

Expand All @@ -342,7 +343,7 @@ internal class CalculatorViewModelTest {
viewModel.onSheetDismissed()
}.firstOrNull().let {
assertNotNull(it)
assertEquals("1000", it.input)
assertEquals(input, it.input)
assertEquals("1 000", it.output)
assertEquals(currency2.symbol, it.symbol)
assertEquals(currency2.code, it.base)
Expand Down

0 comments on commit 932f8c8

Please sign in to comment.