diff --git a/src/main/java/com/moabam/api/application/member/MemberService.java b/src/main/java/com/moabam/api/application/member/MemberService.java index fb0e8637..295a6186 100644 --- a/src/main/java/com/moabam/api/application/member/MemberService.java +++ b/src/main/java/com/moabam/api/application/member/MemberService.java @@ -107,8 +107,10 @@ private void validateNickname(String nickname) { private Member signUp(Long socialId) { Member member = MemberMapper.toMember(socialId); + Member savedMember = memberRepository.save(member); + saveMyEgg(savedMember); - return memberRepository.save(member); + return savedMember; } private void saveMyEgg(Member member) { diff --git a/src/main/java/com/moabam/global/common/util/BaseImageUrl.java b/src/main/java/com/moabam/global/common/util/BaseImageUrl.java index ac66f717..c430933a 100644 --- a/src/main/java/com/moabam/global/common/util/BaseImageUrl.java +++ b/src/main/java/com/moabam/global/common/util/BaseImageUrl.java @@ -14,7 +14,7 @@ public class BaseImageUrl { public static final String DEFAULT_NIGHT_AWAKE_SKIN_URL = ""; public static final String DEFAULT_NIGHT_SLEEP_SKIN_URL = ""; - public static final String DEFAULT_MORNING_EGG_URL = "moabam/skins/오목눈이/기본/오목눈이알.png"; - public static final String DEFAULT_NIGHT_EGG_URL = "moabam/skins/부엉이/기본/부엉이알.png"; - public static final String MEMBER_PROFILE_URL = "moabam/default/기본회원프로필.png"; + public static final String DEFAULT_MORNING_EGG_URL = "moabam/skins/omok/default/egg.png"; + public static final String DEFAULT_NIGHT_EGG_URL = "moabam/skins/owl/default/egg.png"; + public static final String MEMBER_PROFILE_URL = "moabam/default/member-profile.png"; } diff --git a/src/test/java/com/moabam/api/application/member/MemberServiceTest.java b/src/test/java/com/moabam/api/application/member/MemberServiceTest.java index 7a03c38d..a7959641 100644 --- a/src/test/java/com/moabam/api/application/member/MemberServiceTest.java +++ b/src/test/java/com/moabam/api/application/member/MemberServiceTest.java @@ -97,6 +97,8 @@ void signUp_success() { given(member.getId()).willReturn(1L); willReturn(member) .given(memberRepository).save(any(Member.class)); + willReturn(List.of(ItemFixture.morningSantaSkin().build(), ItemFixture.nightMageSkin())) + .given(itemRepository).findAllById(any()); // when LoginResponse result = memberService.login(authorizationTokenInfoResponse); @@ -213,5 +215,4 @@ void modify_success_test(@WithMember AuthMember authMember) { () -> assertThat(member.getProfileImage()).isEqualTo("/main") ); } - } diff --git a/src/test/java/com/moabam/api/presentation/MemberControllerTest.java b/src/test/java/com/moabam/api/presentation/MemberControllerTest.java index a2b7fd16..4c19555c 100644 --- a/src/test/java/com/moabam/api/presentation/MemberControllerTest.java +++ b/src/test/java/com/moabam/api/presentation/MemberControllerTest.java @@ -76,6 +76,8 @@ import com.moabam.support.fixture.RoomFixture; import com.moabam.support.fixture.TokenSaveValueFixture; +import jakarta.persistence.EntityManager; + @Transactional @SpringBootTest @AutoConfigureMockMvc @@ -128,6 +130,9 @@ class MemberControllerTest extends WithoutFilterSupporter { Member member; + @Autowired + EntityManager entityManager; + @BeforeAll void allSetUp() { restTemplateBuilder = new RestTemplateBuilder() @@ -143,6 +148,7 @@ void setUp() { RestTemplate restTemplate = restTemplateBuilder.build(); ReflectionTestUtils.setField(oAuth2AuthorizationServerRequestService, "restTemplate", restTemplate); mockRestServiceServer = MockRestServiceServer.createServer(restTemplate); + member = entityManager.merge(member); } @DisplayName("로그아웃 성공 테스트") @@ -270,6 +276,7 @@ void search_my_info_success() throws Exception { member.changeDefaultSkintUrl(night); member.changeDefaultSkintUrl(morning); + memberRepository.flush(); // expected mockMvc.perform(get("/members")) @@ -317,6 +324,11 @@ void search_my_info_with_no_badge_success() throws Exception { Inventory killerInven = InventoryFixture.inventory(member.getId(), killer); inventoryRepository.saveAll(List.of(nightInven, morningInven, killerInven)); + member.changeDefaultSkintUrl(night); + member.changeDefaultSkintUrl(morning); + + memberRepository.flush(); + // expected mockMvc.perform(get("/members")) .andExpect(status().isOk()) @@ -376,6 +388,10 @@ void search_friend_info_success() throws Exception { memberRepository.flush(); inventoryRepository.saveAll(List.of(nightInven, morningInven, killerInven)); + friend.changeDefaultSkintUrl(morning); + friend.changeDefaultSkintUrl(night); + memberRepository.flush(); + // expected mockMvc.perform(get("/members/{memberId}", friend.getId())) .andExpect(status().isOk())