Limit
Test Cases for "Per Day," "Per PAX," and "Per Booking" Limits with Checkbox Selection
General Logic:
- Users can select one, two, or all three limit types using checkboxes.
- Each selected limit must have a value of at least 1 (no zero or negative values allowed).
- If multiple limits apply, the strictest limit takes priority (whichever is reached first).
- If no checkboxes are selected, the add-on is unrestricted.
Test Cases
| Scenario | Input | Expected Output |
|---|---|---|
| User selects only Per Day limit | Per Day = 5 | The add-on is limited to 5 purchases per day. No limit per PAX or per booking. |
| User selects only Per PAX limit | Per PAX = 2 | Each guest (PAX) can purchase a max of 2 add-ons. No daily or per booking limit. |
| User selects only Per Booking limit | Per Booking = 3 | Each booking can include a max of 3 add-ons, regardless of people number. No daily or per PAX limit. |
| User selects Per Day & Per PAX | Per Day = 10Per PAX = 2 | The system allows 10 add-ons per day. Each guest (PAX) can purchase up to 2 add-ons. If 5 guests book, they can buy up to 10 add-ons max (5 × 2), but no more due to the Per Day limit. |
| User selects Per Day & Per Booking | Per Day = 10Per Booking = 5 | The system allows 10 add-ons per day. Each booking can purchase a max of 5 add-ons. If 3 bookings are made, the third booking can only purchase remaining available add-ons (up to 10 total). |
| User selects Per PAX & Per Booking | Per PAX = 2Per Booking = 5 | Each guest (PAX) can buy up to 2 add-ons. Each booking can include a max of 5 add-ons total. If a booking has 3 guests, they can buy only 5 add-ons max, even though (3 × 2) = 6 would normally be allowed. |
| User selects all three options | Per Day = 10Per PAX = 2Per Booking = 5 | The strictest limit applies first. The system allows 10 add-ons per day. Each guest (PAX) can buy up to 2 add-ons. - Each booking can include a max of 5 add-ons total. - If 2 bookings of 3 guests each are made, each guest can get 2 add-ons, but the system stops at 10 add-ons total. |
| User deselects all checkboxes | Per Day Per PAX Per Booking | The add-on is unlimited (no restrictions). |
| User tries to enter 0 or a negative number in any field | Any limit = 0 or -5 | Show error: "Limit must be at least 1." |
| User enters a large number in Per Day, but low Per PAX | Per Day = 50Per PAX = 1 | The system allows up to 50 add-ons per day. Each guest can only purchase 1 add-on max. If 50 guests book, all add-ons will be sold out. |
| User sets Per PAX higher than Per Booking | Per PAX = 3Per Booking = 2 | Each guest can buy up to 3 add-ons, but the system restricts each booking to only 2 add-ons total. Show warning: "Per Booking limit must be greater than or equal to Per PAX limit." |
| User modifies limits mid-day | Before: Per Day = 10After: Per Day = 5 | If 5 add-ons were already purchased that day, no more add-ons can be bought. |
| Booking crosses the midnight reset | Per Day = 20 | The daily limit resets at 00:00, allowing 20 more add-ons. |
| Per PAX limit exceeded, but Per Day limit allows more | Per PAX = 1Per Day = 10 | A guest trying to buy 2 add-ons cannot proceed, even if the daily limit isn’t reached. |
Error Handling
| Scenario | Expected Behavior |
|---|---|
| User enters 0 or a negative value | Show an error: "Limit must be at least 1." |
| User tries to purchase more than the Per Day limit | Show message: "Maximum add-ons per day reached. Try again tomorrow." |
| User tries to purchase more than the Per PAX limit | Show message: "You can only purchase X add-ons per person." |
| User tries to purchase more than the Per Booking limit | Show message: "Maximum add-ons per booking is X." |
| User sets Per Booking limit lower than Per PAX limit | Prevent saving and show a warning. |
| User changes a limit after add-ons are purchased | System should adjust limits but not affect existing purchases. |