Skip to content

Commit

Permalink
test: reservation overbook
Browse files Browse the repository at this point in the history
  • Loading branch information
labasubagia committed Nov 30, 2024
1 parent ebbca8d commit 2a7d86f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions api_handler_reservation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ func TestReservation(t *testing.T) {
require.NotNil(t, reservation)
})

t.Run("CreateFailOverbook", func(t *testing.T) {
seats := replaceSeat(room.ID)

cart1, rec := testCreateCart(t, token, CartInput{ShowtimeID: showtime.ID, SeatID: seats[0].ID})
require.Equal(t, http.StatusOK, rec.Code)
require.NotNil(t, cart1)

cart2, rec := testCreateCart(t, token, CartInput{ShowtimeID: showtime.ID, SeatID: seats[1].ID})
require.Equal(t, http.StatusOK, rec.Code)
require.NotNil(t, cart2)

reservation, rec := testCreateReservation(t, token, ReservationInput{
CartIDs: []int64{cart1.ID, cart2.ID},
})
require.Equal(t, http.StatusOK, rec.Code)
require.NotNil(t, reservation)

_, rec = testCreateReservation(t, token, ReservationInput{
CartIDs: []int64{cart1.ID, cart2.ID},
})
require.Equal(t, http.StatusBadRequest, rec.Code)
})

t.Run("PayOK", func(t *testing.T) {
seats := replaceSeat(room.ID)

Expand Down

0 comments on commit 2a7d86f

Please sign in to comment.