test: tighten createCard repository delegation normalization coverage
This commit is contained in:
@@ -215,13 +215,34 @@ class BoardDetailRepositoryTest {
|
|||||||
val result = repository.createCard(
|
val result = repository.createCard(
|
||||||
listId = " list-1 ",
|
listId = " list-1 ",
|
||||||
title = " Card title ",
|
title = " Card title ",
|
||||||
description = "Description",
|
description = " Description ",
|
||||||
dueDate = null,
|
dueDate = "2026-03-16T10:15:30Z",
|
||||||
tagIds = listOf(" tag-1 ", "", "tag-2"),
|
tagIds = listOf(" tag-1 ", "", "tag-2", "tag-1", " ", " tag-2"),
|
||||||
)
|
)
|
||||||
|
|
||||||
assertTrue(result is BoardsApiResult.Success<*>)
|
assertTrue(result is BoardsApiResult.Success<*>)
|
||||||
assertEquals("list-1", apiClient.lastCreateCardListPublicId)
|
assertEquals("list-1", apiClient.lastCreateCardListPublicId)
|
||||||
|
assertEquals("Card title", apiClient.lastCreateCardTitle)
|
||||||
|
assertEquals("Description", apiClient.lastCreateCardDescription)
|
||||||
|
assertEquals("2026-03-16T10:15:30Z", apiClient.lastCreateCardDueDate)
|
||||||
|
assertEquals(listOf("tag-1", "tag-2"), apiClient.lastCreateCardTagPublicIds)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun createCard_sendsNullDescriptionWhenBlankAfterTrim() = runTest {
|
||||||
|
val apiClient = FakeBoardDetailApiClient()
|
||||||
|
val repository = createRepository(apiClient = apiClient)
|
||||||
|
|
||||||
|
val result = repository.createCard(
|
||||||
|
listId = "list-1",
|
||||||
|
title = "Card",
|
||||||
|
description = " ",
|
||||||
|
dueDate = null,
|
||||||
|
tagIds = emptyList(),
|
||||||
|
)
|
||||||
|
|
||||||
|
assertTrue(result is BoardsApiResult.Success<*>)
|
||||||
|
assertEquals(null, apiClient.lastCreateCardDescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -486,6 +507,10 @@ class BoardDetailRepositoryTest {
|
|||||||
var lastMoveTargetListId: String? = null
|
var lastMoveTargetListId: String? = null
|
||||||
var getLabelByPublicIdCalls: MutableList<String> = mutableListOf()
|
var getLabelByPublicIdCalls: MutableList<String> = mutableListOf()
|
||||||
var lastCreateCardListPublicId: String? = null
|
var lastCreateCardListPublicId: String? = null
|
||||||
|
var lastCreateCardTitle: String? = null
|
||||||
|
var lastCreateCardDescription: String? = null
|
||||||
|
var lastCreateCardDueDate: String? = null
|
||||||
|
var lastCreateCardTagPublicIds: List<String> = emptyList()
|
||||||
|
|
||||||
override suspend fun healthCheck(baseUrl: String, apiKey: String): AuthResult = AuthResult.Success
|
override suspend fun healthCheck(baseUrl: String, apiKey: String): AuthResult = AuthResult.Success
|
||||||
|
|
||||||
@@ -537,6 +562,10 @@ class BoardDetailRepositoryTest {
|
|||||||
tagPublicIds: List<String>,
|
tagPublicIds: List<String>,
|
||||||
): BoardsApiResult<CreatedEntityRef> {
|
): BoardsApiResult<CreatedEntityRef> {
|
||||||
lastCreateCardListPublicId = listPublicId
|
lastCreateCardListPublicId = listPublicId
|
||||||
|
lastCreateCardTitle = title
|
||||||
|
lastCreateCardDescription = description
|
||||||
|
lastCreateCardDueDate = dueDate
|
||||||
|
lastCreateCardTagPublicIds = tagPublicIds
|
||||||
return createCardResult
|
return createCardResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user