Skip to content

Commit

Permalink
hotfix : 클라이언트 요청 반영 - home 캐릭터 조회 시 타입 반환
Browse files Browse the repository at this point in the history
  • Loading branch information
oownahcohc committed Apr 9, 2024
1 parent 30f8c50 commit c160c73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
import univ.earthbreaker.namu.core.domain.character.current.CurrentCharacter;

public record HomeCharacterResponse(
String characterType,
String imageUrl,
int requiredExp,
int currentExp
) {
static @NotNull HomeCharacterResponse from(@NotNull CurrentCharacter currentCharacter) {
return new HomeCharacterResponse(
currentCharacter.getCharacterType().name(),
IMAGE_ACCESS_URL + currentCharacter.getTargetCharacterMainImage(),
currentCharacter.getStatusRequiredExp(),
currentCharacter.getStatusCurrentExp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static univ.earthbreaker.namu.core.domain.character.CharacterType.*;
import static univ.earthbreaker.namu.core.domain.common.Constant.IMAGE_SYSTEM_PROPERTY;
import static univ.earthbreaker.namu.core.domain.character.CharacterFixture.BEGIN_CURRENT_CHARACTER;
import static univ.earthbreaker.namu.core.domain.character.CharacterFixture.BEGIN_REQUIRED_EXP;
Expand Down Expand Up @@ -61,6 +62,7 @@ void retrieve() throws Exception {
resultActions
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.characterType").value(DEFAULT.name()))
.andExpect(jsonPath("$.imageUrl").value(expectImagePath))
.andExpect(jsonPath("$.requiredExp").value(BEGIN_REQUIRED_EXP))
.andExpect(jsonPath("$.currentExp").value(INITIAL_EXP));
Expand All @@ -76,6 +78,7 @@ void retrieve() throws Exception {
headerWithName(HttpHeaders.AUTHORIZATION).description("회원의 access 토큰 값")
),
responseFields(
fieldWithPath("characterType").type(STRING).description("현재 캐릭터의 타입"),
fieldWithPath("imageUrl").type(STRING).description("현재 캐릭터 이미지 url"),
fieldWithPath("requiredExp").type(NUMBER).description("현재 캐릭터의 요구 경험치"),
fieldWithPath("currentExp").type(NUMBER).description("현재 캐릭터의 현재 경험치")
Expand Down

0 comments on commit c160c73

Please sign in to comment.