Commit e94d36fc authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

Add test for timezone parsing

parent bf2852d1
......@@ -204,6 +204,25 @@ TEST_CASE("door controller parses status json")
REQUIRE(end.tm_sec == 17);
}
SECTION("parser does timezone magic")
{
actual_data = "{\"events\":[{\"begins_at\":\"2020-05-19T22:19:17-07:00\","
"\"ends_at\":\"2020-05-19T22:39:17-10:00\"}],\"status\":\"success\","
"\"code\":200}";
door_status_sync_status_task(nullptr);
schedule_data_p first = static_cast<schedule_data_p>(schedule_list->data);
struct tm start;
localtime_r(&first->start, &start);
struct tm end;
localtime_r(&first->end, &end);
// 10 o'clock in our current tie zone is going to come 3 hours early in a place behind us
// But since we are close to the end of the day roll over at midnight we roll over
// so 1 - 3 = 24 - 3 = 21
// I HATE TIMEZONES
// Also, west coast best coast
REQUIRE(start.tm_hour - end.tm_hour == 21);
}
SECTION("parser wont parse invalid json")
{
actual_data = "hello";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment