Skip to content

Commit 6b0836b

Browse files
committed
Add TaskRepositorySyncTest in :tasks-core with Mockito
1 parent 7aab903 commit 6b0836b

File tree

3 files changed

+1011
-3
lines changed

3 files changed

+1011
-3
lines changed

tasks-app-shared/src/commonTest/kotlin/net/opatry/tasks/data/TaskRepositorySyncTest.kt renamed to tasks-app-shared/src/commonTest/kotlin/net/opatry/tasks/data/TaskRepositorySyncIntegrationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import kotlin.test.assertEquals
3333
import kotlin.test.assertNotNull
3434

3535

36-
class TaskRepositorySyncTest {
36+
class TaskRepositorySyncIntegrationTest {
3737
@Test
3838
fun `when remote task lists with tasks then sync should store data locally`() {
3939
val taskListsApi = InMemoryTaskListsApi("My tasks", "Other tasks")

tasks-core/src/commonMain/kotlin/net/opatry/tasks/data/TaskRepository.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
package net.opatry.tasks.data
2424

25+
import androidx.annotation.VisibleForTesting
2526
import kotlinx.coroutines.Dispatchers
2627
import kotlinx.coroutines.ExperimentalCoroutinesApi
2728
import kotlinx.coroutines.async
@@ -60,7 +61,8 @@ private fun RemoteTaskList.asTaskListEntity(localId: Long?, sorting: LocalTaskLi
6061
)
6162
}
6263

63-
private fun RemoteTask.asTaskEntity(parentListLocalId: Long, parentTaskLocalId: Long?, taskLocalId: Long?): LocalTask {
64+
@VisibleForTesting
65+
internal fun RemoteTask.asTaskEntity(parentListLocalId: Long, parentTaskLocalId: Long?, taskLocalId: Long?): LocalTask {
6466
return LocalTask(
6567
id = taskLocalId ?: 0,
6668
remoteId = id,
@@ -125,7 +127,8 @@ private fun LocalTask.asTaskDataModel(indent: Int, isParentTask: Boolean): TaskD
125127
)
126128
}
127129

128-
private fun LocalTask.asTask(): RemoteTask {
130+
@VisibleForTesting
131+
internal fun LocalTask.asTask(): RemoteTask {
129132
return RemoteTask(
130133
id = remoteId ?: "",
131134
title = title,

0 commit comments

Comments
 (0)