Up until now we’ve gotten away with returning just the current UTC time.
Lets extend our solution to accept a
timezone from the user and return the current time in that timezone.
This one is all on you! What is the first test that you’d like to write?
/api/time/endpoint should accept a
timezonequery parameter that provides a timezone in the IANA “Australia/Melbourne” format
timezonefield should include the name of the timezone
offsetfield should include the current offset for the timezone in
current_timefield should include the current time in the specified timezone
errorkey should be provided in the JSON
What tests did you write? Here’s how I got started (spoilers!)
My test concentrate on the happy path and don’t test many edge cases. Take a moment to think about other things that you could have tested.