feat(home): 팔로잉 인증 헤더를 추가한다
This commit is contained in:
@@ -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" }
|
||||||
@@ -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 "))
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user