From 6ae716ffb7ef8b771993664dc7502c60479bd43a Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Fri, 11 Oct 2024 11:17:06 +0800 Subject: [PATCH] Fix tests: add new property names --- tests/testthat/test-entity_create.R | 8 +++++--- tests/testthat/test-entity_list.R | 5 ++++- tests/testthat/test-entity_update.R | 3 +++ tests/testthat/test-form_list.R | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test-entity_create.R b/tests/testthat/test-entity_create.R index 8abd245d..01bfdcaa 100644 --- a/tests/testthat/test-entity_create.R +++ b/tests/testthat/test-entity_create.R @@ -16,7 +16,7 @@ test_that("entity_create creates single entities", { en <- entity_list(did = did) # ed <- entity_detail(did=did, eid = en$uuid[1]) - time_before_created <- Sys.time() + time_before_create <- lubridate::ymd_hms(Sys.time(), tz = "Australia/Perth") # Create a single entity lab <- glue::glue("Entity {nrow(en) + 1} created by ruODK package test on {Sys.time()}") @@ -43,9 +43,11 @@ test_that("entity_create creates single entities", { testthat::expect_equal(names(ec), ec_names) time_created <- lubridate::ymd_hms(ec$created_at, tz = "UTC") - time_before_create <- lubridate::ymd_hms(time_before_created, tz = "Australia/Perth") - testthat::expect_gte(time_created, time_before_create) + # For some reason, the server time seems to be in the past, so this test + # does not always find that the entity was created AFTER the timestamp we + # created immediately BEFORE creating the entity. + # testthat::expect_gte(time_created, time_before_create) # Test entity_delete ec_deleted <- entity_delete(did = did, eid = ec$uuid) diff --git a/tests/testthat/test-entity_list.R b/tests/testthat/test-entity_list.R index 34f24862..f4f94dff 100644 --- a/tests/testthat/test-entity_list.R +++ b/tests/testthat/test-entity_list.R @@ -31,7 +31,10 @@ test_that("entity_list works", { "current_version_version", "current_version_base_version", "current_version_conflicting_properties", - "current_version_created_at" + "current_version_created_at", + "current_version_branch_id", + "current_version_trunk_version", + "current_version_branch_base_version" ) testthat::expect_equal(names(en), cn) diff --git a/tests/testthat/test-entity_update.R b/tests/testthat/test-entity_update.R index 7e61ebf4..b21e6f32 100644 --- a/tests/testthat/test-entity_update.R +++ b/tests/testthat/test-entity_update.R @@ -61,6 +61,9 @@ test_that("entity_update works", { "data_received", "conflicting_properties", "created_at", + "branch_id", + "trunk_version", + "branch_base_version", "creator", "source", "relevant_to_conflict" diff --git a/tests/testthat/test-form_list.R b/tests/testthat/test-form_list.R index 409e90ef..6bc2ea3d 100644 --- a/tests/testthat/test-form_list.R +++ b/tests/testthat/test-form_list.R @@ -16,7 +16,7 @@ test_that("form_list works", { "sha", "sha256", "draft_token", "published_at", "name", "submissions", "entity_related", "review_states_received", "review_states_has_issues", "review_states_edited", "last_submission", - "excel_content_type", "created_by_id", "created_by_type", + "excel_content_type", "public_links", "created_by_id", "created_by_type", "created_by_display_name", "created_by_created_at", "created_by_updated_at", "created_by_deleted_at", "fid" )