test(home): FIRST 오디오 chevron 검증을 추가한다
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package kr.co.vividnext.sodalive.v2.main.home
|
||||
|
||||
import android.app.Application
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(application = Application::class)
|
||||
class HomeMainFragmentSourceTest {
|
||||
|
||||
@Test
|
||||
fun `홈 FIRST 오디오 섹션 타이틀은 chevron만 표시하고 전체보기 이동은 연결하지 않는다`() {
|
||||
val source = projectFile(
|
||||
"app/src/main/java/kr/co/vividnext/sodalive/v2/main/home/HomeMainFragment.kt"
|
||||
).readText()
|
||||
|
||||
assertTrue(source.contains("binding.viewHomeFirstAudioTitle.setTitle("))
|
||||
assertTrue(
|
||||
"FIRST audio title must show the section chevron in Phase 2.",
|
||||
source.contains(
|
||||
"binding.viewHomeFirstAudioTitle.setTitle(\n" +
|
||||
" R.string.home_recommendation_section_first_audio_contents,\n" +
|
||||
" showMore = true"
|
||||
)
|
||||
)
|
||||
assertTrue(
|
||||
"Phase 2 must not connect FIRST audio overview navigation yet.",
|
||||
!source.contains("binding.viewHomeFirstAudioTitle.ivSectionTitleChevron.setOnClickListener")
|
||||
)
|
||||
}
|
||||
|
||||
private fun projectFile(relativePath: String): File {
|
||||
val candidates = listOf(File(relativePath), File("../$relativePath"))
|
||||
return candidates.firstOrNull { it.exists() }
|
||||
?: error("Project file not found: $relativePath")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user