From 61917fd6132104ec7150405644761945da170969 Mon Sep 17 00:00:00 2001 From: Dev Uni Date: Wed, 29 Nov 2023 22:49:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B0=A9=EC=9E=A5=20=EB=B0=A9=20?= =?UTF-8?q?=EB=82=98=EA=B0=80=EA=B8=B0=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#184)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/moabam/api/application/room/RoomService.java | 2 ++ .../java/com/moabam/api/presentation/RoomControllerTest.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/com/moabam/api/application/room/RoomService.java b/src/main/java/com/moabam/api/application/room/RoomService.java index d14228a6..b4a90fcd 100644 --- a/src/main/java/com/moabam/api/application/room/RoomService.java +++ b/src/main/java/com/moabam/api/application/room/RoomService.java @@ -116,6 +116,8 @@ public void exitRoom(Long memberId, Long roomId) { return; } + List routines = routineRepository.findAllByRoomId(roomId); + routineRepository.deleteAll(routines); roomRepository.delete(room); } diff --git a/src/test/java/com/moabam/api/presentation/RoomControllerTest.java b/src/test/java/com/moabam/api/presentation/RoomControllerTest.java index 61170e45..c922bc93 100644 --- a/src/test/java/com/moabam/api/presentation/RoomControllerTest.java +++ b/src/test/java/com/moabam/api/presentation/RoomControllerTest.java @@ -663,10 +663,13 @@ void manager_delete_room_success() throws Exception { .maxUserCount(8) .build(); + List routines = RoomFixture.routines(room); + Participant participant = RoomFixture.participant(room, 1L); participant.enableManager(); roomRepository.save(room); + routineRepository.saveAll(routines); participantRepository.save(participant); // expected @@ -675,9 +678,11 @@ void manager_delete_room_success() throws Exception { .andDo(print()); List deletedRoom = roomRepository.findAll(); + List deletedRoutine = routineRepository.findAll(); List 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();