Created
June 26, 2021 20:48
-
-
Save orcchg/d5ebab6c5e8390b87f147ba9f78c05fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class TestStockListViewModel { | |
| @Inject internal lateinit var viewModel: StockListViewModel | |
| @get:Rule val instantExecutorRule = InstantTaskExecutorRule() | |
| private val featureApi: TestStockListFeatureComponent = | |
| DaggerTestStockListFeatureComponent.create() | |
| init { | |
| featureApi.inject(this) | |
| } | |
| @Test | |
| fun `test get stocks`() { | |
| val actualTickers = viewModel.stocks.value?.map { it.ticker } | |
| val expectedTickers = featureApi.interactor | |
| .stocks() | |
| .blockingGet() | |
| .map { it.ticker } | |
| Assert.assertNotNull(expectedTickers) | |
| Assert.assertNotNull(actualTickers) | |
| Assert.assertArrayEquals( | |
| expectedTickers.toTypedArray(), | |
| actualTickers!!.toTypedArray() | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment