How would you test a date-range search for a hotel stay or a flight?
JuniorCover the date logic: check-in before check-out, same-day, maximum stay, past dates rejected, and far-future boundaries — plus availability for the selected range.
// What interviewers look for
That date ranges carry domain rules (ordering, minimum/maximum stay, no past travel) beyond simple field validation.
Common pitfall
Testing the two date fields independently and missing the relationship rules — accepting a check-out before check-in, or a stay in the past.
Model answer
I'd test the relationship between the dates, not just each field. Core cases: check-in before check-out (valid), check-out before check-in (rejected), same-day check-in/out per the product rule, and a single-night minimum. Boundaries: today as check-in, a past date rejected, the maximum advance-booking horizon, and a stay longer than the allowed maximum. I'd cover availability for the chosen range — a range that's partially unavailable should surface clearly, not silently shorten. For flights I'd add one-way vs return, and a return date before departure. I'd test month/year rollovers and that the picker and the server agree on the same constraints, since client-only validation can be bypassed. The thread is that a date range is a constrained pair with travel-specific rules, so I test the pair and its domain limits.
searchdatesvalidationavailability
What timezone test cases matter when booking a flight that departs and arrives in different zones?
JuniorAssert departure and arrival show in their own local times, handle overnight and date-line crossings, and verify DST transitions don't corrupt the displayed duration or arrival day.
// What interviewers look for
Itinerary-specific time reasoning: depart-local vs arrive-local, date-line crossings producing 'arrive the day before', and DST transitions — not generic 'test the timezone' answers.
Common pitfall
Doing naive UTC arithmetic and showing both times in one zone, so an overnight flight or a date-line crossing displays the wrong arrival day or a negative duration.
Model answer
I'd anchor every case to the itinerary. Departure time must display in the origin's local zone and arrival in the destination's local zone, with the computed duration matching the true elapsed time regardless of the offset between them. Then the hard cases: an overnight flight where arrival is the next calendar day; a westbound trans-Pacific flight crossing the date line where you arrive 'the day before' you left in local terms; and a flight scheduled across a DST transition in either endpoint, where a naive calculation gains or loses an hour and corrupts the duration. I'd test a same-zone flight as the control, and a red-eye near midnight where off-by-one-day bugs surface. I'd verify the stored times are unambiguous (UTC plus zone) and only converted for display. The signal is that this is itinerary time, where 'when and where' are coupled, not a single-clock conversion.
timezonedstitinerarydates