Skip to content

Commit

Permalink
test: 다락방 멤버 목록 조회 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
ay-eonii committed Oct 4, 2024
1 parent 57aec94 commit 8ad3705
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

Expand All @@ -13,7 +15,10 @@
import mouda.backend.common.fixture.MemberFixture;
import mouda.backend.darakbang.domain.Darakbang;
import mouda.backend.darakbang.infrastructure.DarakbangRepository;
import mouda.backend.darakbangmember.domain.DarakBangMemberRole;
import mouda.backend.darakbangmember.domain.DarakbangMember;
import mouda.backend.darakbangmember.infrastructure.DarakbangMemberRepository;
import mouda.backend.darakbangmember.presentation.response.DarakbangMemberResponses;
import mouda.backend.darakbangmember.presentation.response.DarakbangMemberRoleResponse;
import mouda.backend.member.domain.Member;
import mouda.backend.member.infrastructure.MemberRepository;
Expand Down Expand Up @@ -51,4 +56,29 @@ void success() {
assertThat(response.role()).isEqualTo("OUTSIDER");
}
}

@DisplayName("다락방 멤버 조회 테스트")
@Nested
class DarakbangMemberReadTest {

@DisplayName("모든 다락방 멤버는 다락방 멤버 목록을 조회할 수 있다.")
@EnumSource(mode = EnumSource.Mode.INCLUDE, names = {"MANAGER", "MEMBER"})
@ParameterizedTest
void failToReadWithoutDarakbangManager(DarakBangMemberRole darakBangMemberRole) {
Member hogee = memberRepository.save(MemberFixture.getHogee());
Darakbang darakbang = darakbangRepository.save(DarakbangFixture.getDarakbangWithWooteco());
DarakbangMember darakbangMember = DarakbangMember.builder()
.darakbang(darakbang)
.memberId(hogee.getId())
.nickname("소소파파")
.role(darakBangMemberRole)
.build();
DarakbangMember darakbangHogee = darakbangMemberRepository.save(darakbangMember);

DarakbangMemberResponses responses = darakbangMemberService.findAllDarakbangMembers(
darakbang.getId(), darakbangHogee);

assertThat(responses.responses()).hasSize(1);
}
}
}

0 comments on commit 8ad3705

Please sign in to comment.