Skip to content

Commit

Permalink
test: 테스트 코드 추가 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
gitchannn authored Nov 1, 2023
1 parent 8d91ab9 commit c41098f
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static sallange.server.acceptance.step.CycleCreateStep.살랑이_생성_요청하고_아이디_반환;
import static sallange.server.acceptance.step.CycleRentStep.살랑이_대여_요청;
import static sallange.server.acceptance.step.CycleReturnStep.살랑이_반납_요청;
import static sallange.server.acceptance.step.UsersJoinStep.회원_가_요청하고_액세스_토큰_반환;

class CycleRentAcceptanceTest extends AcceptanceTest {
Expand Down Expand Up @@ -55,6 +56,24 @@ class CycleRentAcceptanceTest extends AcceptanceTest {
);
}

@Test
void 회원_후에_3_빌리면_대여가_안된다() {
final String accessToken = 회원_가_요청하고_액세스_토큰_반환(new UserJoinRequest("깃짱", "KAKAO", 123L, 2));
final Long cycleId = 살랑이_생성_요청하고_아이디_반환();

살랑이_대여_요청(accessToken, RentRequest.from(cycleId));
살랑이_반납_요청(accessToken);
살랑이_대여_요청(accessToken, RentRequest.from(cycleId));
살랑이_반납_요청(accessToken);

final ExtractableResponse<Response> response = 살랑이_대여_요청(accessToken, RentRequest.from(cycleId));

assertAll(
() -> assertThat(response.statusCode()).isEqualTo(BAD_REQUEST.value()),
() -> assertThat(response.jsonPath().getInt("errorCode")).isEqualTo(3)
);
}

@Test
void 이미_다른_살랑이를_대여하면서__다른_살랑이를_대여하면_에러_코드_4_반환하다() {
final String accessToken = 회원_가_요청하고_액세스_토큰_반환(new UserJoinRequest("깃짱", "KAKAO", 123L, 2));
Expand Down

0 comments on commit c41098f

Please sign in to comment.