feat(home): 팔로잉 인증 헤더를 추가한다

This commit is contained in:
2026-06-25 22:22:11 +09:00
parent 2d9200ec4d
commit 21d3ed4603
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package kr.co.vividnext.sodalive.v2.main.home.model
fun homeFollowingAuthHeader(token: String): String? = token
.trim()
.takeIf { it.isNotEmpty() }
?.let { "Bearer $it" }

View File

@@ -0,0 +1,25 @@
package kr.co.vividnext.sodalive.v2.main.home
import kr.co.vividnext.sodalive.v2.main.home.model.homeFollowingAuthHeader
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
class HomeFollowingAuthHeaderTest {
@Test
fun `blank token은 null을 반환한다`() {
assertNull(homeFollowingAuthHeader(""))
assertNull(homeFollowingAuthHeader(" "))
}
@Test
fun `non blank token은 Bearer header를 반환한다`() {
assertEquals("Bearer token-1", homeFollowingAuthHeader("token-1"))
}
@Test
fun `token 앞뒤 공백은 trim 후 Bearer header를 반환한다`() {
assertEquals("Bearer token-1", homeFollowingAuthHeader(" token-1 "))
}
}