feat(content-banner): 오디오 콘텐츠 배너를 언어별로 등록하고 노출한다
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package kr.co.vividnext.sodalive.content.main.banner
|
||||
|
||||
import kr.co.vividnext.sodalive.configs.QueryDslConfig
|
||||
import kr.co.vividnext.sodalive.i18n.Lang
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
|
||||
import org.springframework.context.annotation.Import
|
||||
|
||||
@DataJpaTest
|
||||
@Import(QueryDslConfig::class)
|
||||
class AudioContentBannerRepositoryTest @Autowired constructor(
|
||||
private val repository: AudioContentBannerRepository
|
||||
) {
|
||||
@Test
|
||||
@DisplayName("사용자 배너 조회는 요청 언어와 일치하는 배너만 반환한다")
|
||||
fun shouldReturnOnlyRequestedLanguageBanners() {
|
||||
repository.saveAndFlush(
|
||||
AudioContentBanner(
|
||||
thumbnailImage = "banner/ko.png",
|
||||
type = AudioContentBannerType.LINK,
|
||||
lang = Lang.KO
|
||||
).apply {
|
||||
link = "https://ko.example.com"
|
||||
}
|
||||
)
|
||||
repository.saveAndFlush(
|
||||
AudioContentBanner(
|
||||
thumbnailImage = "banner/ja.png",
|
||||
type = AudioContentBannerType.LINK,
|
||||
lang = Lang.JA
|
||||
).apply {
|
||||
link = "https://ja.example.com"
|
||||
}
|
||||
)
|
||||
|
||||
val banners = repository.getAudioContentMainBannerList(tabId = 1L, isAdult = false, lang = Lang.JA)
|
||||
|
||||
assertEquals(1, banners.size)
|
||||
assertEquals(Lang.JA, banners.first().lang)
|
||||
assertEquals("https://ja.example.com", banners.first().link)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user