Skip to content

Commit

Permalink
test: writer imageUrl 필드 추가 테스트 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
hun-ca committed Aug 4, 2024
1 parent f55fc23 commit df3b398
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class MemberDao(
Member.MEMBER.ID.`as`(WriterRecord::writerId.name),
DSL.jsonGetAttributeAsText(Member.MEMBER.DESCRIPTION, "name")
.`as`(WriterRecord::name.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name)
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "url").`as`(WriterRecord::url.name),
DSL.jsonGetAttribute(Member.MEMBER.DESCRIPTION, "imageUrl").`as`(WriterRecord::imageUrl.name)
)
.from(Member.MEMBER)
.where(Member.MEMBER.ID.`in`(notCachedIds))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import java.net.URL
data class WriterDescription(
val name: String,
val url: URL,
val imageUrl: URL,
)
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ class MemberDaoTest : JooqTestSpec() {
.execute()

val writerDescription = writerDescriptionJsonMapper.toJson(
WriterDescription("few2", URL("http://localhost:8080/writers/url2"))
WriterDescription(
"few2",
URL("http://localhost:8080/writers/url2"),
URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
)
)

dslContext.insertInto(Member.MEMBER)
Expand Down Expand Up @@ -100,7 +104,11 @@ class MemberDaoTest : JooqTestSpec() {
fun setMoreWriters(count: Int) {
for (i in 3 until 3 + count) {
val writerDescription = writerDescriptionJsonMapper.toJson(
WriterDescription("few$i", URL("http://localhost:8080/writers/url$i"))
WriterDescription(
"few$i",
URL("http://localhost:8080/writers/url$i"),
URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
)
)
dslContext.insertInto(Member.MEMBER)
.set(Member.MEMBER.ID, i.toLong())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class CommonJsonMapperTest {
// Given
val writerDescription = WriterDescription(
name = "writer",
url = URL("http://localhost:8080/writers/url")
url = URL("http://localhost:8080/writers/url"),
imageUrl = URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
)

// When
Expand All @@ -34,7 +35,8 @@ class CommonJsonMapperTest {
val json = """
{
"name": "writer",
"url": "http://localhost:8080/writers/url"
"url": "http://localhost:8080/writers/url",
"imageUrl": "https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742"
}
""".trimIndent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ class MemberDaoExplainGenerateTest : JooqTestSpec() {
.execute()

val writerDescription = writerDescriptionJsonMapper.toJson(
WriterDescription("few2", URL("http://localhost:8080/writers/url2"))
WriterDescription(
"few2",
URL("http://localhost:8080/writers/url2"),
URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
)
)

dslContext.insertInto(Member.MEMBER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class ReadArticleUseCaseTest : BehaviorSpec({
val writerSvcOutDto = ReadWriterOutDto(
writerId = 1L,
name = "hunca",
url = URL("https://jh-labs.tistory.com/")
url = URL("https://jh-labs.tistory.com/"),
imageUrl = URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
)
val probSvcOutDto = BrowseArticleProblemsOutDto(problemIds = listOf(1, 2, 3))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class ArticleControllerTest : ControllerTestSpec() {
writer = WriterDetail(
id = 1L,
name = "안나포",
url = URL("http://localhost:8080/api/v1/writers/1")
url = URL("http://localhost:8080/api/v1/writers/1"),
imageUrl = URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
),
mainImageUrl = URL("https://github.com/YAPP-Github/24th-Web-Team-1-BE/assets/102807742/0643d805-5f3a-4563-8c48-2a7d51795326"),
title = "ETF(상장 지수 펀드)란? 모르면 손해라고?",
Expand Down Expand Up @@ -115,6 +116,8 @@ class ArticleControllerTest : ControllerTestSpec() {
.fieldWithString("아티클 작가 이름"),
PayloadDocumentation.fieldWithPath("data.writer.url")
.fieldWithString("아티클 작가 링크"),
PayloadDocumentation.fieldWithPath("data.writer.imageUrl")
.fieldWithString("아티클 작가 이미지 링크(non-null)"),
PayloadDocumentation.fieldWithPath("data.mainImageUrl")
.fieldWithString("아티클 썸네일 이미지 링크"),
PayloadDocumentation.fieldWithPath("data.title")
Expand Down Expand Up @@ -161,7 +164,8 @@ class ArticleControllerTest : ControllerTestSpec() {
writer = WriterDetail(
id = 1L,
name = "안나포",
url = URL("http://localhost:8080/api/v1/writers/1")
url = URL("http://localhost:8080/api/v1/writers/1"),
imageUrl = URL("https://github.com/user-attachments/assets/28df9078-488c-49d6-9375-54ce5a250742")
),
mainImageUrl = URL("https://github.com/YAPP-Github/24th-Web-Team-1-BE/assets/102807742/0643d805-5f3a-4563-8c48-2a7d51795326"),
title = "ETF(상장 지수 펀드)란? 모르면 손해라고?",
Expand Down Expand Up @@ -218,6 +222,8 @@ class ArticleControllerTest : ControllerTestSpec() {
.fieldWithString("아티클 작가 이름"),
PayloadDocumentation.fieldWithPath("data.articles[].writer.url")
.fieldWithString("아티클 작가 링크"),
PayloadDocumentation.fieldWithPath("data.articles[].writer.imageUrl")
.fieldWithString("아티클 작가 이미지 링크(non-null)"),
PayloadDocumentation.fieldWithPath("data.articles[].mainImageUrl")
.fieldWithString("아티클 썸네일 이미지 링크"),
PayloadDocumentation.fieldWithPath("data.articles[].title")
Expand Down

0 comments on commit df3b398

Please sign in to comment.