Skip to content

Commit

Permalink
fix: 방장 방 나가기 코드 수정 (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shin-Jae-Yoon authored Nov 29, 2023
1 parent d20bf17 commit 61917fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public void exitRoom(Long memberId, Long roomId) {
return;
}

List<Routine> routines = routineRepository.findAllByRoomId(roomId);
routineRepository.deleteAll(routines);
roomRepository.delete(room);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,10 +663,13 @@ void manager_delete_room_success() throws Exception {
.maxUserCount(8)
.build();

List<Routine> routines = RoomFixture.routines(room);

Participant participant = RoomFixture.participant(room, 1L);
participant.enableManager();

roomRepository.save(room);
routineRepository.saveAll(routines);
participantRepository.save(participant);

// expected
Expand All @@ -675,9 +678,11 @@ void manager_delete_room_success() throws Exception {
.andDo(print());

List<Room> deletedRoom = roomRepository.findAll();
List<Routine> deletedRoutine = routineRepository.findAll();
List<Participant> deletedParticipant = participantRepository.findAll();

assertThat(deletedRoom).isEmpty();
assertThat(deletedRoutine).hasSize(0);
assertThat(deletedParticipant).hasSize(1);
assertThat(deletedParticipant.get(0).getDeletedAt()).isNotNull();
assertThat(deletedParticipant.get(0).getDeletedRoomTitle()).isNotNull();
Expand Down

0 comments on commit 61917fd

Please sign in to comment.