Skip to content

Commit

Permalink
feat : 대기 취소 통합 테스트 검증 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hyun2371 committed Jan 6, 2024
1 parent dacf3b3 commit fd0a4ca
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static com.prgrms.catchtable.waiting.domain.WaitingStatus.COMPLETED;
import static com.prgrms.catchtable.waiting.domain.WaitingStatus.PROGRESS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.springframework.http.MediaType.APPLICATION_JSON;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
Expand All @@ -12,6 +13,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import com.prgrms.catchtable.common.base.BaseIntegrationTest;
import com.prgrms.catchtable.common.exception.custom.NotFoundCustomException;
import com.prgrms.catchtable.member.MemberFixture;
import com.prgrms.catchtable.member.domain.Member;
import com.prgrms.catchtable.member.repository.MemberRepository;
Expand Down Expand Up @@ -160,7 +162,7 @@ void postponeWaiting_fails2() throws Exception {
.andDo(MockMvcResultHandlers.print());
}

@DisplayName("웨이팅을 취소할 수 있다. 취소 시 뒤에 있는 사람들은 rank가 1씩 증가한다.")
@DisplayName("웨이팅 취소 API를 추가할 수 있다.")
@Test
void cancelWaiting() throws Exception {
//when, then
Expand All @@ -174,8 +176,11 @@ void cancelWaiting() throws Exception {
.andExpect(jsonPath("$.peopleCount").value(waiting1.getPeopleCount()))
.andExpect(jsonPath("$.status").value(CANCELED.getDescription()))
.andDo(MockMvcResultHandlers.print());

assertThat(waitingLineRepository.findRank(1L, 2L)).isEqualTo(1L);
assertThat(waitingLineRepository.findRank(1L, 3L)).isEqualTo(2L);
assertThrows(NotFoundCustomException.class,
() -> waitingLineRepository.findRank(1L, 1L));
}

@DisplayName("웨이팅 진행 상태가 아니면 취소가 불가하다.")
Expand Down

0 comments on commit fd0a4ca

Please sign in to comment.