-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/#901 온보딩에서 활동 설정 시 관심태그도 함께 설정 #903
base: backend-main
Are you sure you want to change the base?
The head ref may contain hidden characters: "Feature/#901-\uC628\uBCF4\uB529\uC5D0\uC11C_\uD65C\uB3D9_\uC124\uC815_\uC2DC_\uAD00\uC2EC\uD0DC\uADF8\uB3C4_\uD568\uAED8_\uC124\uC815"
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.mockito.ArgumentMatchers.anyList; | ||
import static org.mockito.ArgumentMatchers.anyString; | ||
import static org.mockito.Mockito.times; | ||
|
@@ -13,10 +15,15 @@ | |
|
||
import com.emmsale.helper.ServiceIntegrationTestHelper; | ||
import com.emmsale.member.application.dto.DescriptionRequest; | ||
import com.emmsale.member.application.dto.MemberActivityInitialRequest; | ||
import com.emmsale.member.domain.InterestTagRepository; | ||
import com.emmsale.member.domain.Member; | ||
import com.emmsale.member.domain.MemberRepository; | ||
import com.emmsale.member.exception.MemberException; | ||
import com.emmsale.member.exception.MemberExceptionType; | ||
import com.emmsale.tag.domain.Tag; | ||
import com.emmsale.tag.domain.TagRepository; | ||
import java.util.List; | ||
import org.assertj.core.api.ThrowableAssert.ThrowingCallable; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
|
@@ -37,6 +44,34 @@ class MemberCommandServiceTest extends ServiceIntegrationTestHelper { | |
private MemberCommandService memberCommandService; | ||
@Autowired | ||
private MemberRepository memberRepository; | ||
@Autowired | ||
private InterestTagRepository interestTagRepository; | ||
@Autowired | ||
private TagRepository tagRepository; | ||
|
||
@Test | ||
@DisplayName("Activity의 id를 통해서, 사용자의 Activity를 등록하고 사용자의 이름을 수정할 수 있다.") | ||
void registerActivities() throws Exception { | ||
//given | ||
tagRepository.save(new Tag("Backend")); | ||
final List<Long> activityIds = List.of(1L, 2L, 6L); | ||
final long savedMemberId = 1L; | ||
|
||
final Member member = memberRepository.findById(savedMemberId).get(); | ||
final String updateName = "우르"; | ||
|
||
final MemberActivityInitialRequest request = new MemberActivityInitialRequest(updateName, | ||
activityIds); | ||
|
||
//when & then | ||
assertAll( | ||
() -> assertDoesNotThrow( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요 assertDoesNotThrow 부분은 따로 분리해보면 어떤가요? 저 부분에서 에러가 나지 않는 것을 굳이 assertAll로 감싸고 체크할 필요는 없다고 생각해요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 분리해주었습니다~ |
||
() -> memberCommandService.initializeMember(member, request)), | ||
() -> assertEquals(updateName, member.getName()), | ||
() -> assertEquals(1, | ||
interestTagRepository.findInterestTagsByMemberId(savedMemberId).size()) | ||
); | ||
} | ||
|
||
@Nested | ||
@DisplayName("한줄 자기소개를 업데이트한다.") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,11 @@ insert into member(id, name, image_url, open_profile_url, github_id, github_user | |
values (2, 'member2', 'https://imageurl.com', 'https://openprofileurl.com', 2, 'amaran-th22', | ||
CURRENT_TIMESTAMP(), | ||
CURRENT_TIMESTAMP()); | ||
insert into member(id, name, image_url, open_profile_url, github_id, github_username, created_at, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 혹시 해당 로직은 왜 추가한건지 알 수 있을까요? 저희가 되도록이면 data-test.sql을 안 건들기로 했었어서요 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이런 데이터 하나 추가로 변경해야될 테스트 코드도 있는거 같아서요 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 엥 그러네요... MemberFixture를 추가하면 된다는 생각을 못 했었나봅니다,,, 다시 삭제해두겠습니다 |
||
updated_at) | ||
values (3, null, 'https://imageurl.com', 'https://openprofileurl.com', 33, 'amaran-th333', | ||
CURRENT_TIMESTAMP(), | ||
CURRENT_TIMESTAMP()); | ||
|
||
insert into member_activity(id, activity_id, member_id, created_at, updated_at) | ||
values (1, 1, 1, CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
멤버의 온보딩 여부를 interestTag에서 해주고 있는데,
Member를 initializae 시키는 initializeMember에서 예외처리하는게 적절해보여요.
그러면 온보딩이 된 멤버의 경우 불필요한 activity 조회 등록도 안 일어날 것 같고요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 반영하겠습니다!