|
4 | 4 | import static org.assertj.core.api.Assertions.assertThatCode; |
5 | 5 | import static org.assertj.core.api.AssertionsForClassTypes.tuple; |
6 | 6 |
|
| 7 | +import com.example.solidconnection.chat.domain.ChatRoom; |
| 8 | +import com.example.solidconnection.chat.fixture.ChatRoomFixture; |
7 | 9 | import com.example.solidconnection.common.VerifyStatus; |
8 | 10 | import com.example.solidconnection.common.dto.SliceResponse; |
9 | 11 | import com.example.solidconnection.common.exception.CustomException; |
@@ -45,6 +47,9 @@ class MentoringQueryServiceTest { |
45 | 47 | @Autowired |
46 | 48 | private MentoringRepository mentoringRepository; |
47 | 49 |
|
| 50 | + @Autowired |
| 51 | + private ChatRoomFixture chatRoomFixture; |
| 52 | + |
48 | 53 | private SiteUser mentorUser1, mentorUser2; |
49 | 54 | private SiteUser menteeUser1, menteeUser2, menteeUser3; |
50 | 55 | private Mentor mentor1, mentor2, mentor3; |
@@ -146,21 +151,23 @@ class 멘티의_멘토링_목록_조회_테스트 { |
146 | 151 | } |
147 | 152 |
|
148 | 153 | @Test |
149 | | - void 승인된_멘토링_목록을_조회한다() { |
| 154 | + void 승인된_멘토링_목록과_대응하는_채팅방을_조회한다() { |
150 | 155 | // given |
151 | 156 | Mentoring mentoring1 = mentoringFixture.승인된_멘토링(mentor1.getId(), menteeUser1.getId()); |
152 | 157 | Mentoring mentoring2 = mentoringFixture.승인된_멘토링(mentor2.getId(), menteeUser1.getId()); |
| 158 | + ChatRoom mentoringChatRoom1 = chatRoomFixture.멘토링_채팅방(mentoring1.getId()); |
| 159 | + ChatRoom mentoringChatRoom2 = chatRoomFixture.멘토링_채팅방(mentoring2.getId()); |
153 | 160 | mentoringFixture.대기중_멘토링(mentor3.getId(), menteeUser1.getId()); |
154 | 161 |
|
155 | 162 | // when |
156 | 163 | SliceResponse<MentoringForMenteeResponse> response = mentoringQueryService.getMentoringsForMentee( |
157 | 164 | menteeUser1.getId(), VerifyStatus.APPROVED, pageable); |
158 | 165 |
|
159 | 166 | // then |
160 | | - assertThat(response.content()).extracting(MentoringForMenteeResponse::mentoringId) |
| 167 | + assertThat(response.content()).extracting(MentoringForMenteeResponse::mentoringId, MentoringForMenteeResponse::chatRoomId) |
161 | 168 | .containsExactlyInAnyOrder( |
162 | | - mentoring1.getId(), |
163 | | - mentoring2.getId() |
| 169 | + tuple(mentoring1.getId(), mentoringChatRoom1.getId()), |
| 170 | + tuple(mentoring2.getId(), mentoringChatRoom2.getId()) |
164 | 171 | ); |
165 | 172 | } |
166 | 173 |
|
|
0 commit comments