Skip to content

Commit e15fde8

Browse files
veyndancopybara-github
authored andcommitted
[GH] Remove explicit Unit return when using runTest
`kotlinx.coroutines.test.runTest` returns a `kotlinx.coroutines.test.TestResult`. Per [its documentation](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/-test-result/), JVM and native just type alias to Unit, but when targeting JS it returns a `Promise`. This explicit return type of `Unit` is therefore incorrect when targeting JS. Test: ./gradlew test connectedCheck Bug: 270612487 This is an imported pull request from #554. Resolves #554 Github-Pr-Head-Sha: ed0a00b GitOrigin-RevId: 155638a Change-Id: I3333e47c9b8fee3e9a3cfc98171f5abc6e400301
1 parent a938fb6 commit e15fde8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

paging/paging-common/src/test/kotlin/androidx/paging/CachingTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ class CachingTest {
452452
* invalidations create new PagingData BUT a new collector only sees the latest one.
453453
*/
454454
@Test
455-
public fun unusedPagingDataIsNeverCollectedByNewDownstream(): Unit = testScope.runTest {
455+
public fun unusedPagingDataIsNeverCollectedByNewDownstream() = testScope.runTest {
456456
val factory = StringPagingSource.VersionedFactory()
457457
val flow = buildPageFlow(factory).cachedIn(backgroundScope, tracker)
458458
val collector = ItemCollector(flow)
@@ -517,7 +517,7 @@ class CachingTest {
517517
}
518518

519519
@Test
520-
public fun unusedPagingDataIsNeverCached(): Unit = testScope.runTest {
520+
public fun unusedPagingDataIsNeverCached() = testScope.runTest {
521521
val factory = StringPagingSource.VersionedFactory()
522522
val flow = buildPageFlow(factory).cachedIn(backgroundScope, tracker)
523523
val collector = ItemCollector(flow)

paging/paging-common/src/test/kotlin/androidx/paging/PositionalDataSourceTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ class PositionalDataSourceTest {
453453
private val testScope = TestScope(UnconfinedTestDispatcher())
454454

455455
@OptIn(ExperimentalCoroutinesApi::class)
456-
private fun verifyRefreshIsTerminal(counted: Boolean): Unit = testScope.runTest {
456+
private fun verifyRefreshIsTerminal(counted: Boolean) = testScope.runTest {
457457
val dataSource = ListDataSource(list = listOf(0, 1, 2), counted = counted)
458458
dataSource.load(
459459
DataSource.Params(

0 commit comments

Comments
 (0)