Skip to content

Commit

Permalink
Fix tests: add new property names
Browse files Browse the repository at this point in the history
  • Loading branch information
florianm committed Oct 11, 2024
1 parent c6f09b5 commit 6ae716f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
8 changes: 5 additions & 3 deletions tests/testthat/test-entity_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()}")
Expand All @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-entity_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-entity_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-form_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 6ae716f

Please sign in to comment.