Skip to content

Commit

Permalink
test: 역량 키워드 조회 테스트 코드 작성(#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
whereami2048 committed May 17, 2024
1 parent 1c2aadf commit ecb4d18
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class StrongPointGetService(
val strongPointInfos = strongPointReader.readAllByUserId(it).map { strongPoint ->
GetStrongPoint.StrongPointInfo(strongPoint.id, strongPoint.name)
}

GetStrongPoint.Response(strongPointInfos.size, strongPointInfos)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.bamyanggang.apimodule.domain.strongpoint.presentation

import com.bamyanggang.apimodule.BaseRestDocsTest
import com.bamyanggang.apimodule.domain.strongpoint.application.dto.CreateStrongPoint
import com.bamyanggang.apimodule.domain.strongpoint.application.dto.GetStrongPoint
import com.bamyanggang.commonmodule.exception.ExceptionHandler
import com.bamyanggang.commonmodule.fixture.generateFixture
import com.bamyanggang.domainmodule.domain.strongpoint.exception.StrongPointException
Expand Down Expand Up @@ -138,4 +139,35 @@ class StrongPointControllerTest : BaseRestDocsTest() {
)
)
}

@Test
@DisplayName("유저가 등록한 역량 키워드를 전체 조회한다.")
fun getALlStrongPointTest() {

val strongPointInfo1 = GetStrongPoint.StrongPointInfo(generateFixture<UUID>(), "역량 키워드 1")
val strongPointInfo2 = GetStrongPoint.StrongPointInfo(generateFixture<UUID>(), "역량 키워드 2")

val strongPointInfos = arrayListOf(strongPointInfo1, strongPointInfo2)
val getStrongPointResponse = GetStrongPoint.Response(strongPointInfos.size, strongPointInfos)

given(strongPointController.getAllStrongPoints()).willReturn(getStrongPointResponse)

val request = RestDocumentationRequestBuilders.get(StrongPointApi.BASE_URL)
.header("Authorization", "Bearer AccessToken")

val result = mockMvc.perform(request)

result.andExpect(status().isOk)
.andDo(resultHandler.document(
requestHeaders(
headerWithName("Authorization").description("엑세스 토큰")
),
responseFields(
fieldWithPath("count").description("역량 키워드 개수"),
fieldWithPath("strongPoints[].id").description("역량 키워드 id"),
fieldWithPath("strongPoints[].name").description("역량 키워드 이름"),
)
)
)
}
}

0 comments on commit ecb4d18

Please sign in to comment.