Skip to content

Commit e9788ff

Browse files
committed
test: 삭제 테스트 수정
1 parent 86ecc64 commit e9788ff

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/test/java/com/back/domain/study/plan/controller/StudyPlanControllerTest.java

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,12 @@ void t12() throws Exception {
530530
.andExpect(status().isOk()) // 200 OK
531531
.andExpect(handler().handlerType(StudyPlanController.class))
532532
.andExpect(jsonPath("$.success").value(true))
533-
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."));
533+
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."))
534+
.andExpect(jsonPath("$.data.id").value(planId))
535+
.andExpect(jsonPath("$.data.subject").value(originalPlan.getSubject()))
536+
.andExpect(jsonPath("$.data.color").value(originalPlan.getColor()))
537+
.andExpect(jsonPath("$.data.deletedDate").value("2025-10-01"))
538+
.andExpect(jsonPath("$.data.applyScope").value("THIS_ONLY"));
534539

535540
// DB에서 실제로 삭제되었는지 확인
536541
boolean exists = studyPlanRepository.existsById(planId);
@@ -552,7 +557,14 @@ void t13() throws Exception {
552557
.andExpect(status().isOk()) // 200 OK
553558
.andExpect(handler().handlerType(StudyPlanController.class))
554559
.andExpect(jsonPath("$.success").value(true))
555-
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."));
560+
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."))
561+
.andExpect(jsonPath("$.data.id").value(planId))
562+
.andExpect(jsonPath("$.data.subject").value(originalPlan.getSubject()))
563+
.andExpect(jsonPath("$.data.deletedDate").value("2025-10-01"))
564+
.andExpect(jsonPath("$.data.applyScope").value("THIS_ONLY"))
565+
.andExpect(jsonPath("$.data.startDate").value("2025-10-01T09:00:00"))
566+
.andExpect(jsonPath("$.data.endDate").value("2025-10-01T11:00:00"));
567+
556568
// 10월 1일에 해당하는 계획은 없어야함
557569
mvc.perform(get("/api/plans/date/2025-10-01")
558570
.header("Authorization", "Bearer faketoken")
@@ -583,7 +595,10 @@ void t14() throws Exception {
583595
.andExpect(status().isOk()) // 200 OK
584596
.andExpect(handler().handlerType(StudyPlanController.class))
585597
.andExpect(jsonPath("$.success").value(true))
586-
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."));
598+
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."))
599+
.andExpect(jsonPath("$.data.id").value(planId))
600+
.andExpect(jsonPath("$.data.deletedDate").value("2025-10-01"))
601+
.andExpect(jsonPath("$.data.applyScope").value("FROM_THIS_DATE"));
587602

588603
// 10월 10일에 해당하는 계획도 없어야함
589604
mvc.perform(get("/api/plans/date/2025-10-10")
@@ -608,7 +623,12 @@ void t15() throws Exception {
608623
.andExpect(status().isOk()) // 200 OK
609624
.andExpect(handler().handlerType(StudyPlanController.class))
610625
.andExpect(jsonPath("$.success").value(true))
611-
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."));
626+
.andExpect(jsonPath("$.message").value("학습 계획이 성공적으로 삭제되었습니다."))
627+
.andExpect(jsonPath("$.data.id").value(planId))
628+
.andExpect(jsonPath("$.data.deletedDate").value("2025-10-10"))
629+
.andExpect(jsonPath("$.data.applyScope").value("FROM_THIS_DATE"))
630+
.andExpect(jsonPath("$.data.startDate").value("2025-10-10T09:00:00"))
631+
.andExpect(jsonPath("$.data.endDate").value("2025-10-10T11:00:00"));
612632

613633
// 10월 1일에 해당하는 계획은 있어야함
614634
mvc.perform(get("/api/plans/date/2025-10-01")
@@ -617,7 +637,7 @@ void t15() throws Exception {
617637
.andDo(print())
618638
.andExpect(jsonPath("$.data.totalCount").value(1));
619639

620-
// 10.10 이후에 해당하는 계획은 없어야함
640+
// 10.10 이후에 해당하는 계획은 없어야함
621641
mvc.perform(get("/api/plans?start=2025-10-10&end=2025-10-15")
622642
.header("Authorization", "Bearer faketoken")
623643
.contentType(MediaType.APPLICATION_JSON))
@@ -626,5 +646,4 @@ void t15() throws Exception {
626646
.andExpect(jsonPath("$.data", hasSize(0)));
627647
}
628648

629-
630649
}

0 commit comments

Comments
 (0)