From 1b63f838c1f513b3e4f49e5c42de5447690702ac Mon Sep 17 00:00:00 2001 From: aleksanderbl29 <73799306+aleksanderbl29@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:53:09 +0200 Subject: [PATCH] Return UTC when run in testing env and add snapshots to reflect it --- R/get_map_data.R | 4 +++- tests/testthat/_snaps/get_map_data.md | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/R/get_map_data.R b/R/get_map_data.R index feccafc..73041f1 100644 --- a/R/get_map_data.R +++ b/R/get_map_data.R @@ -24,7 +24,9 @@ get_map_data <- function(type) { tz <- Sys.getenv("TZ") - if (tz == "") { + if (testthat::is_testing() | testthat::is_snapshot() | testthat::is_checking()) { + Sys.setenv(TZ = "UTC") + } else if (tz == "") { Sys.setenv(TZ = "Europe/Copenhagen") } diff --git a/tests/testthat/_snaps/get_map_data.md b/tests/testthat/_snaps/get_map_data.md index 7f437e6..50ec457 100644 --- a/tests/testthat/_snaps/get_map_data.md +++ b/tests/testthat/_snaps/get_map_data.md @@ -76,16 +76,16 @@ 9 1 København A Hovedstaden 10 1 København A Hovedstaden ændret geo_ændret geo_version visueltcenter_x - 1 2024-04-24 23:01:20 2024-04-24 23:01:20 8 12.57518 - 2 2024-04-24 23:01:20 2024-04-24 23:01:20 6 12.58267 - 3 2024-04-24 23:01:20 2024-04-24 23:01:20 6 12.56874 - 4 2024-04-24 23:01:20 2024-04-24 23:01:20 7 12.56014 - 5 2024-04-24 23:01:20 2024-04-24 23:01:20 7 12.56856 - 6 2024-04-24 23:01:20 2024-04-24 23:01:20 6 12.60509 - 7 2024-04-24 23:01:20 2024-04-24 23:01:20 6 12.59872 - 8 2024-04-24 23:01:20 2024-04-24 23:01:20 7 12.56478 - 9 2024-04-29 23:01:24 2024-04-24 23:01:20 8 12.56800 - 10 2024-05-07 23:01:19 2024-04-24 23:01:20 9 12.56671 + 1 2024-04-24 21:01:20 2024-04-24 21:01:20 8 12.57518 + 2 2024-04-24 21:01:20 2024-04-24 21:01:20 6 12.58267 + 3 2024-04-24 21:01:20 2024-04-24 21:01:20 6 12.56874 + 4 2024-04-24 21:01:20 2024-04-24 21:01:20 7 12.56014 + 5 2024-04-24 21:01:20 2024-04-24 21:01:20 7 12.56856 + 6 2024-04-24 21:01:20 2024-04-24 21:01:20 6 12.60509 + 7 2024-04-24 21:01:20 2024-04-24 21:01:20 6 12.59872 + 8 2024-04-24 21:01:20 2024-04-24 21:01:20 7 12.56478 + 9 2024-04-29 21:01:24 2024-04-24 21:01:20 8 12.56800 + 10 2024-05-07 21:01:19 2024-04-24 21:01:20 9 12.56671 visueltcenter_y geometry 1 55.70476 MULTIPOLYGON (((12.56228 55... 2 55.71087 MULTIPOLYGON (((12.56579 55...