Skip to content

Commit 6bed161

Browse files
committed
test: 멘티의 멘토링 목록 조회 시 채팅방 ID 포함 테스트 추가
1 parent 0625d39 commit 6bed161

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/test/java/com/example/solidconnection/mentor/service/MentoringQueryServiceTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import static org.assertj.core.api.Assertions.assertThatCode;
55
import static org.assertj.core.api.AssertionsForClassTypes.tuple;
66

7+
import com.example.solidconnection.chat.domain.ChatRoom;
8+
import com.example.solidconnection.chat.fixture.ChatRoomFixture;
79
import com.example.solidconnection.common.VerifyStatus;
810
import com.example.solidconnection.common.dto.SliceResponse;
911
import com.example.solidconnection.common.exception.CustomException;
@@ -45,6 +47,9 @@ class MentoringQueryServiceTest {
4547
@Autowired
4648
private MentoringRepository mentoringRepository;
4749

50+
@Autowired
51+
private ChatRoomFixture chatRoomFixture;
52+
4853
private SiteUser mentorUser1, mentorUser2;
4954
private SiteUser menteeUser1, menteeUser2, menteeUser3;
5055
private Mentor mentor1, mentor2, mentor3;
@@ -146,21 +151,23 @@ class 멘티의_멘토링_목록_조회_테스트 {
146151
}
147152

148153
@Test
149-
void 승인된_멘토링_목록을_조회한다() {
154+
void 승인된_멘토링_목록과_대응하는_채팅방을_조회한다() {
150155
// given
151156
Mentoring mentoring1 = mentoringFixture.승인된_멘토링(mentor1.getId(), menteeUser1.getId());
152157
Mentoring mentoring2 = mentoringFixture.승인된_멘토링(mentor2.getId(), menteeUser1.getId());
158+
ChatRoom mentoringChatRoom1 = chatRoomFixture.멘토링_채팅방(mentoring1.getId());
159+
ChatRoom mentoringChatRoom2 = chatRoomFixture.멘토링_채팅방(mentoring2.getId());
153160
mentoringFixture.대기중_멘토링(mentor3.getId(), menteeUser1.getId());
154161

155162
// when
156163
SliceResponse<MentoringForMenteeResponse> response = mentoringQueryService.getMentoringsForMentee(
157164
menteeUser1.getId(), VerifyStatus.APPROVED, pageable);
158165

159166
// then
160-
assertThat(response.content()).extracting(MentoringForMenteeResponse::mentoringId)
167+
assertThat(response.content()).extracting(MentoringForMenteeResponse::mentoringId, MentoringForMenteeResponse::chatRoomId)
161168
.containsExactlyInAnyOrder(
162-
mentoring1.getId(),
163-
mentoring2.getId()
169+
tuple(mentoring1.getId(), mentoringChatRoom1.getId()),
170+
tuple(mentoring2.getId(), mentoringChatRoom2.getId())
164171
);
165172
}
166173

0 commit comments

Comments
 (0)