From 81f102c47c2edb4e9e46b1b58fd612914448fc28 Mon Sep 17 00:00:00 2001 From: "Steven M. Mortimer" Date: Mon, 4 Nov 2024 12:30:46 -0600 Subject: [PATCH] Fixing failing tests --- tests/testthat/test-report.R | 209 ++++++++++++++++++----------------- tests/testthat/test-rest.R | 96 ++++++++-------- 2 files changed, 153 insertions(+), 152 deletions(-) diff --git a/tests/testthat/test-report.R b/tests/testthat/test-report.R index a17282b7..02e51838 100644 --- a/tests/testthat/test-report.R +++ b/tests/testthat/test-report.R @@ -1,31 +1,31 @@ context("Report") -key_report_metadata_fields <- c("aggregates", - "hasDetailRows", - "id", +key_report_metadata_fields <- c("aggregates", + "hasDetailRows", + "id", "name", - "reportBooleanFilter", - "reportFilters", - "reportFormat", - "reportType", + "reportBooleanFilter", + "reportFilters", + "reportFormat", + "reportType", "showGrandTotal", "showSubtotals", "sortBy") common_report_id <- "00O3s000006tE7zEAE" -report_col_names <- c("Contact ID", "First Name", "test number", "Contact Owner", +report_col_names <- c("Contact ID", "First Name", "test number", "Contact Owner", "Account ID", "Account Name", "Billing City", "Account Owner") test_that("testing sf_list_reports()", { # as_tbl=TRUE reports_tbl <- sf_list_reports() expect_is(reports_tbl, "tbl_df") - expect_true(common_report_id %in% reports_tbl$id) + expect_true(common_report_id %in% reports_tbl$id) # as_tbl=FALSE reports_list <- sf_list_reports(as_tbl=FALSE) expect_is(reports_list, "list") - + # recent=TRUE reports_tbl <- sf_list_reports(recent=TRUE) expect_is(reports_tbl, "tbl_df") @@ -34,9 +34,9 @@ test_that("testing sf_list_reports()", { test_that("testing sf_describe_report()", { report_described <- sf_describe_report(common_report_id) expect_is(report_described, "list") - expect_named(report_described, c("attributes", - "reportExtendedMetadata", - "reportMetadata", + expect_named(report_described, c("attributes", + "reportExtendedMetadata", + "reportMetadata", "reportTypeMetadata")) expect_true(all(key_report_metadata_fields %in% names(report_described$reportMetadata))) }) @@ -44,15 +44,15 @@ test_that("testing sf_describe_report()", { test_that("testing sf_create_report()", { # creating a blank report using just the name and type prefix <- paste0("TEST Report-", as.integer(runif(1,1,100000)), "-") - my_new_report <- sf_create_report(sprintf("%s Top Accounts Report", prefix), + my_new_report <- sf_create_report(sprintf("%s Top Accounts Report", prefix), report_type = "AccountList") expect_is(my_new_report, "list") - expect_named(my_new_report, c("attributes", - "reportExtendedMetadata", - "reportMetadata", + expect_named(my_new_report, c("attributes", + "reportExtendedMetadata", + "reportMetadata", "reportTypeMetadata")) expect_true(all(key_report_metadata_fields %in% names(my_new_report$reportMetadata))) - + # cleanup the new report expect_true(sf_delete_report(my_new_report$reportMetadata$id)) }) @@ -61,24 +61,24 @@ test_that("testing sf_copy_report()", { report_described <- sf_describe_report(common_report_id) report_copy_described <- sf_copy_report(common_report_id) expect_is(report_copy_described, "list") - expect_named(report_copy_described, c("attributes", - "reportExtendedMetadata", - "reportMetadata", + expect_named(report_copy_described, c("attributes", + "reportExtendedMetadata", + "reportMetadata", "reportTypeMetadata")) - expect_true(all(key_report_metadata_fields %in% - names(report_copy_described$reportMetadata))) + expect_true(all(key_report_metadata_fields %in% + names(report_copy_described$reportMetadata))) expect_true(grepl(" - Copy$", report_copy_described$reportMetadata$name)) - + # key elements are identical - expect_equal(report_described$reportMetadata$reportFormat, + expect_equal(report_described$reportMetadata$reportFormat, report_copy_described$reportMetadata$reportFormat) - expect_equal(report_described$reportMetadata$reportType$type, + expect_equal(report_described$reportMetadata$reportType$type, report_copy_described$reportMetadata$reportType$type) - expect_equal(report_described$reportMetadata$hasDetailRows, + expect_equal(report_described$reportMetadata$hasDetailRows, report_copy_described$reportMetadata$hasDetailRows) - expect_equal(report_described$reportMetadata$detailColumns, + expect_equal(report_described$reportMetadata$detailColumns, report_copy_described$reportMetadata$detailColumns) - + # clean up the copy report_copy_id <- report_copy_described$reportMetadata$id expect_true(sf_delete_report(report_copy_id)) @@ -89,29 +89,29 @@ test_that("testing sf_update_report()", { prefix <- paste0("TEST Report-", as.integer(runif(1,1,100000))) new_report_name <- sprintf("%s - Top Accounts Report", prefix) my_new_report <- sf_create_report(name = new_report_name, report_type = "AccountList") - + # update that new report updated_report_name <- sprintf("%s - Updated Name!", prefix) my_updated_report <- sf_update_report(my_new_report$reportMetadata$id, report_metadata = list(reportMetadata = list(name = updated_report_name))) expect_is(my_updated_report, "list") - expect_named(my_updated_report, c("attributes", - "reportExtendedMetadata", - "reportMetadata", + expect_named(my_updated_report, c("attributes", + "reportExtendedMetadata", + "reportMetadata", "reportTypeMetadata")) expect_true(all(key_report_metadata_fields %in% names(my_updated_report$reportMetadata))) - + # key elements are identical except for the name expect_equal(my_new_report$reportMetadata$name, new_report_name) expect_equal(my_updated_report$reportMetadata$name, updated_report_name) expect_equal(my_new_report$reportMetadata$id, my_updated_report$reportMetadata$id) - expect_equal(my_new_report$reportMetadata$reportType$type, + expect_equal(my_new_report$reportMetadata$reportType$type, my_updated_report$reportMetadata$reportType$type) - expect_equal(my_new_report$reportMetadata$hasDetailRows, + expect_equal(my_new_report$reportMetadata$hasDetailRows, my_updated_report$reportMetadata$hasDetailRows) - expect_equal(my_new_report$reportMetadata$detailColumns, + expect_equal(my_new_report$reportMetadata$detailColumns, my_updated_report$reportMetadata$detailColumns) - + # cleanup the new report expect_true(sf_delete_report(my_updated_report$reportMetadata$id)) }) @@ -119,7 +119,7 @@ test_that("testing sf_update_report()", { test_that("testing sf_delete_report()", { # creating a blank report prefix <- paste0("TEST Report-", as.integer(runif(1,1,100000)), "-") - my_new_report <- sf_create_report(sprintf("%s Top Accounts Report", prefix), + my_new_report <- sf_create_report(sprintf("%s Top Accounts Report", prefix), report_type = "AccountList") # cleanup the new report expect_true(sf_delete_report(my_new_report$reportMetadata$id)) @@ -134,13 +134,13 @@ test_that("testing sf_list_report_instances()", { # as_tbl=FALSE report_instances_list <- sf_list_report_instances(common_report_id, as_tbl = FALSE) expect_is(report_instances_list, "list") - + # fake report Id expect_error( sf_list_report_instances("12395y223409820"), "FORBIDDEN: You don’t have sufficient privileges to perform this operation." - ) - + ) + # wait for the report instance to complete ... status_complete <- FALSE z <- 1 @@ -158,16 +158,16 @@ test_that("testing sf_list_report_instances()", { z <- z + 1 } } - + # clean up the report instance - expect_true(sf_delete_report_instance(common_report_id, + expect_true(sf_delete_report_instance(common_report_id, this_report_instance$id)) }) test_that("testing sf_delete_report_instance()", { - + this_report_instance <- sf_execute_report(common_report_id, async=TRUE) - + # wait for the report instance to complete ... status_complete <- FALSE z <- 1 @@ -185,20 +185,20 @@ test_that("testing sf_delete_report_instance()", { z <- z + 1 } } - - result <- sf_delete_report_instance(common_report_id, + + result <- sf_delete_report_instance(common_report_id, this_report_instance$id) expect_true(result) - + # real report Id, but a fake report instance Id expect_error( sf_delete_report_instance(common_report_id, "12395y223409820"), "NOT_FOUND: We couldn’t find a report instance to match the URL of your request." - ) - + ) + # fake report Id, but not a fake report instance Id expect_error( - sf_delete_report_instance("12395y223409820", "12395y223409820"), + sf_delete_report_instance("12395y223409820", "12395y223409820"), "FORBIDDEN: You don’t have sufficient privileges to perform this operation." ) }) @@ -206,14 +206,15 @@ test_that("testing sf_delete_report_instance()", { test_that("testing sf_list_report_types()", { report_types_tbl <- sf_list_report_types() expect_is(report_types_tbl, "tbl_df") - expect_named(report_types_tbl, c("label", + expect_named(report_types_tbl, c("label", "reportTypes.describeUrl", "reportTypes.isCustomReportType", - "reportTypes.isHidden", - "reportTypes.isHistorical", - "reportTypes.label", - "reportTypes.supportsJoinedFormat", - "reportTypes.type", + "reportTypes.isDataCloudReportType", + "reportTypes.isHidden", + "reportTypes.isHistorical", + "reportTypes.label", + "reportTypes.supportsJoinedFormat", + "reportTypes.type", "reportTypes.description")) # as_tbl = FALSE report_types_list <- sf_list_report_types(as_tbl = FALSE) @@ -224,9 +225,9 @@ test_that("testing sf_describe_report_type()", { this_report_type <- "AccountList" account_list_report_type <- sf_describe_report_type(this_report_type) expect_is(account_list_report_type, "list") - expect_named(account_list_report_type, c("attributes", - "reportExtendedMetadata", - "reportMetadata", + expect_named(account_list_report_type, c("attributes", + "reportExtendedMetadata", + "reportMetadata", "reportTypeMetadata")) expect_equal(account_list_report_type$reportMetadata$reportType$type, this_report_type) expect_true(all(key_report_metadata_fields %in% names(account_list_report_type$reportMetadata))) @@ -236,9 +237,9 @@ test_that("testing sf_list_report_fields()", { # as_tbl = TRUE report_fields <- sf_list_report_fields(common_report_id) expect_is(report_fields, "list") - expect_named(report_fields, c("displayGroups", - "equivalentFieldIndices", - "equivalentFields", + expect_named(report_fields, c("displayGroups", + "equivalentFieldIndices", + "equivalentFields", "mergedGroups")) }) @@ -247,7 +248,7 @@ test_that("testing sf_list_report_filter_operators()", { filter_ops_tbl <- sf_list_report_filter_operators() expect_is(filter_ops_tbl, "tbl_df") expect_named(filter_ops_tbl, c("supported_field_type", "label", "name")) - + # as_tbl = FALSE filter_ops_list <- sf_list_report_filter_operators(as_tbl = FALSE) expect_is(filter_ops_list, "list") @@ -265,46 +266,46 @@ test_that("testing sf_execute_report() synchronously", { expect_is(common_report_df, "tbl_df") expect_equal(common_report_df$`Contact ID`, common_report_df$`First Name`) expect_equal(common_report_df$`Account ID`, common_report_df$`Account Name`) - + # sync, without guessing types - common_report_df <- sf_execute_report(common_report_id, + common_report_df <- sf_execute_report(common_report_id, guess_types = FALSE) expect_is(common_report_df, "tbl_df") expect_true(all(sapply(common_report_df, class) == "character")) - + # sync, with complete metadata element report_details <- sf_describe_report(common_report_id) report_details$reportMetadata$reportFilters[[2]]$operator <- "equals" - common_report_df <- sf_execute_report(common_report_id, + common_report_df <- sf_execute_report(common_report_id, report_metadata = report_details$reportMetadata) expect_is(common_report_df, "tbl_df") expect_equal(nrow(common_report_df), 1) expect_named(common_report_df, report_col_names) - expect_is(common_report_df$`test number`, "numeric") - + expect_is(common_report_df$`test number`, "numeric") + # report that is requesting to sort by too many fields at once report_details <- sf_describe_report(common_report_id) - report_details$reportMetadata$sortBy <- list(list(sortColumn = 'Contact.test_number__c', - sortOrder = "Asc"), - list(sortColumn = 'ACCOUNT.ADDRESS1_CITY', + report_details$reportMetadata$sortBy <- list(list(sortColumn = 'Contact.test_number__c', + sortOrder = "Asc"), + list(sortColumn = 'ACCOUNT.ADDRESS1_CITY', sortOrder = "Desc")) expect_error( - sf_execute_report(common_report_id, - async = FALSE, - report_metadata = report_details$reportMetadata), + sf_execute_report(common_report_id, + async = FALSE, + report_metadata = report_details$reportMetadata), "BAD_REQUEST: A report can only be sorted by one column." ) }) test_that("testing sf_execute_report() asynchronously", { - + # async common_report_instance <- sf_execute_report(common_report_id, async=TRUE) expect_is(common_report_instance, "tbl_df") - expect_named(common_report_instance, c("id", "ownerId", "status", - "requestDate", "completionDate", + expect_named(common_report_instance, c("id", "ownerId", "status", + "requestDate", "completionDate", "hasDetailRows", "queryable", "url")) - + # wait for the report to complete ... status_complete <- FALSE z <- 1 @@ -332,30 +333,30 @@ test_that("testing sf_execute_report() asynchronously", { expect_is(results, "tbl_df") expect_named(results, report_col_names) expect_is(results$`test number`, "numeric") - + # test with a Fact Map other than "T!T" expect_error( sf_get_report_instance_results(common_report_id, common_report_instance$id, - fact_map_key = ""), + fact_map_key = ""), "Fact map key is not 'T!T'" ) }) test_that("testing sf_run_report()", { - - # simple sync report + + # simple sync report results <- sf_run_report(common_report_id, async=FALSE) expect_is(results, "tbl_df") expect_named(results, report_col_names) - expect_is(results$`test number`, "numeric") - - # simple async report + expect_is(results$`test number`, "numeric") + + # simple async report results <- sf_run_report(common_report_id) expect_is(results, "tbl_df") expect_named(results, report_col_names) - expect_is(results$`test number`, "numeric") - + expect_is(results$`test number`, "numeric") + # filtered report filter1 <- list(column = "CREATED_DATE", operator = "lessThan", @@ -363,27 +364,27 @@ test_that("testing sf_run_report()", { filter2 <- list(column = "ACCOUNT.ADDRESS1_CITY", operator = "equals", value = "") - filtered_results <- sf_run_report(common_report_id, + filtered_results <- sf_run_report(common_report_id, report_boolean_logic = "1 AND 2", report_filters = list(filter1, filter2)) expect_is(filtered_results, "tbl_df") expect_gte(nrow(filtered_results), 1) expect_named(filtered_results, report_col_names) - expect_is(filtered_results$`test number`, "numeric") - + expect_is(filtered_results$`test number`, "numeric") + # sorted by the top test number - results <- sf_run_report(common_report_id, - async = FALSE, - sort_by = 'Contact.test_number__c', + results <- sf_run_report(common_report_id, + async = FALSE, + sort_by = 'Contact.test_number__c', decreasing = TRUE, top_n = 3) expect_is(results, "tbl_df") expect_equal(nrow(results), 3) expect_named(results, report_col_names) expect_equal(results$`test number`, c(99, 23, NA)) - + # limited to the first result - results <- sf_run_report(common_report_id, + results <- sf_run_report(common_report_id, async = FALSE, sort_by = 'Contact.test_number__c', decreasing = TRUE, @@ -395,19 +396,19 @@ test_that("testing sf_run_report()", { # trying to take top N without having a sortby argument expect_error( - sf_run_report(common_report_id, - async = FALSE, + sf_run_report(common_report_id, + async = FALSE, top_n = 1), "A report must be sorted by one column when requesting a Top N number of rows." ) - + # trying to sort by more than 1 field expect_error( - sf_run_report(common_report_id, - async = FALSE, + sf_run_report(common_report_id, + async = FALSE, sort_by = c("Contact.test_number__c", "ACCOUNT.ADDRESS1_CITY")), "Currently, Salesforce will only allow a report to be sorted by, at most, one column." - ) + ) }) test_that("testing sf_query_report()", { diff --git a/tests/testthat/test-rest.R b/tests/testthat/test-rest.R index b37e91e8..d98cba5f 100644 --- a/tests/testthat/test-rest.R +++ b/tests/testthat/test-rest.R @@ -1,47 +1,47 @@ context("REST API") test_that("testing REST API Functionality", { - + n <- 2 object <- "Contact" prefix <- paste0("REST-", as.integer(runif(1,1,100000)), "-") new_contacts <- tibble(FirstName = rep("Test", n), - LastName = paste0("REST-Contact-Create-", 1:n), + LastName = paste0("REST-Contact-Create-", 1:n), My_External_Id__c = paste0(prefix, letters[1:n])) - # sf_create ------------------------------------------------------------------ + # sf_create ------------------------------------------------------------------ created_records <- sf_create(new_contacts, object_name = object, api_type="REST") expect_is(created_records, "tbl_df") - expect_equal(names(created_records), c("id", "success")) + expect_equal(names(created_records), c("id", "success", "errors")) expect_equal(nrow(created_records), n) expect_is(created_records$success, "logical") - + # sf_create error ------------------------------------------------------------ new_campaign_members <- tibble(CampaignId = "", ContactId = "0036A000002C6MbQAK") - create_error_records <- sf_create(new_campaign_members, - object_name = "CampaignMember", + create_error_records <- sf_create(new_campaign_members, + object_name = "CampaignMember", api_type = "REST") expect_is(create_error_records, "tbl_df") expect_equal(names(create_error_records), c("success", "errors")) expect_equal(nrow(create_error_records), 1) expect_is(create_error_records$errors, "list") expect_equal(length(create_error_records$errors[1][[1]]), 2) - expect_equal(names(create_error_records$errors[1][[1]][[1]]), + expect_equal(names(create_error_records$errors[1][[1]][[1]]), c("statusCode", "message", "fields")) - + new_campaign_members <- tibble(CampaignId = "7013s000000j6n1AAA", ContactId = "0036A000002C6MbQAK") - create_error_records <- sf_create(new_campaign_members, - object_name = "CampaignMember", + create_error_records <- sf_create(new_campaign_members, + object_name = "CampaignMember", api_type = "REST") expect_is(create_error_records, "tbl_df") expect_equal(names(create_error_records), c("success", "errors")) expect_equal(nrow(create_error_records), 1) - expect_is(create_error_records$errors, "list") + expect_is(create_error_records$errors, "list") expect_equal(length(create_error_records$errors[1][[1]]), 1) - expect_equal(sort(names(create_error_records$errors[1][[1]][[1]])), + expect_equal(sort(names(create_error_records$errors[1][[1]][[1]])), c("fields", "message", "statusCode")) - + # sf_create duplicate -------------------------------------------------------- dupe_n <- 3 prefix <- paste0("KEEP-", as.integer(runif(1,1,100000)), "-") @@ -51,79 +51,79 @@ test_that("testing REST API Functionality", { Phone = rep("(123) 456-7890", dupe_n), test_number__c = rep(999.9, dupe_n), My_External_Id__c = paste0(prefix, 1:dupe_n, "ZZZ")) - dupe_records <- sf_create(new_contacts, - object_name = "Contact", + dupe_records <- sf_create(new_contacts, + object_name = "Contact", api_type = "REST", - control = list(allowSave = FALSE, + control = list(allowSave = FALSE, includeRecordDetails = TRUE, runAsCurrentUser = TRUE)) expect_is(dupe_records, "tbl_df") expect_equal(names(dupe_records), c("success", "errors")) expect_equal(nrow(dupe_records), dupe_n) - expect_is(dupe_records$errors, "list") + expect_is(dupe_records$errors, "list") expect_equal(length(dupe_records$errors[1][[1]]), 1) - expect_equal(sort(names(dupe_records$errors[1][[1]][[1]])), + expect_equal(sort(names(dupe_records$errors[1][[1]][[1]])), c("fields", "message", "statusCode")) - - # sf_retrieve ---------------------------------------------------------------- - retrieved_records <- sf_retrieve(ids = created_records$id, - fields = c("FirstName", "LastName"), - object_name = object, + + # sf_retrieve ---------------------------------------------------------------- + retrieved_records <- sf_retrieve(ids = created_records$id, + fields = c("FirstName", "LastName"), + object_name = object, api_type = "REST") expect_is(retrieved_records, "tbl_df") expect_equal(names(retrieved_records), c("sObject", "Id", "FirstName", "LastName")) expect_equal(nrow(retrieved_records), n) - + # FYI: Will not find newly created records because records need to be indexed # Just search for some default records - my_sosl <- paste("FIND {(336)} in phone fields returning", + my_sosl <- paste("FIND {(336)} in phone fields returning", "contact(id, firstname, lastname, my_external_id__c),", "lead(id, firstname, lastname)") # sf_search ------------------------------------------------------------------ - searched_records <- sf_search(my_sosl, is_sosl=TRUE, api_type="REST") + searched_records <- sf_search(my_sosl, is_sosl=TRUE, api_type="REST") expect_is(searched_records, "tbl_df") expect_named(searched_records, c("sObject", "Id", "FirstName", "LastName")) expect_equal(nrow(searched_records), 3) - - my_soql <- sprintf("SELECT Id, - FirstName, - LastName, + + my_soql <- sprintf("SELECT Id, + FirstName, + LastName, My_External_Id__c - FROM Contact - WHERE Id in ('%s')", + FROM Contact + WHERE Id in ('%s')", paste0(created_records$id , collapse="','")) # sf_query ------------------------------------------------------------------- queried_records <- sf_query(my_soql, object_name = object , api_type="REST") expect_is(queried_records, "tbl_df") expect_equal(names(queried_records), c("Id", "FirstName", "LastName", "My_External_Id__c")) expect_equal(nrow(queried_records), n) - + queried_records <- queried_records %>% mutate(FirstName = "TestTest") - + # sf_update ------------------------------------------------------------------ updated_records <- sf_update(queried_records, object_name = object, api_type="REST") expect_is(updated_records, "tbl_df") - expect_equal(names(updated_records), c("id", "success")) + expect_equal(names(updated_records), c("id", "success", "errors")) expect_equal(nrow(updated_records), n) expect_is(updated_records$success, "logical") - + new_record <- tibble(FirstName = "Test", - LastName = paste0("REST-Contact-Upsert-", n+1), + LastName = paste0("REST-Contact-Upsert-", n+1), My_External_Id__c=paste0(prefix, letters[n+1])) upserted_contacts <- bind_rows(queried_records %>% select(-Id), new_record) # sf_upsert ------------------------------------------------------------------ - upserted_records <- sf_upsert(input_data = upserted_contacts, - object_name = object, - external_id_fieldname = "My_External_Id__c", + upserted_records <- sf_upsert(input_data = upserted_contacts, + object_name = object, + external_id_fieldname = "My_External_Id__c", api_type = "REST") expect_is(upserted_records, "tbl_df") - expect_equal(names(upserted_records), c("id", "success", "created")) + expect_equal(names(upserted_records), c("id", "success", "created", "errors")) expect_equal(nrow(upserted_records), nrow(upserted_records)) expect_equal(upserted_records$success, c(TRUE, TRUE, TRUE)) expect_equal(upserted_records$created, c(FALSE, FALSE, TRUE)) - + # sf_create_attachment ------------------------------------------------------- attachment_details <- tibble(Name = c("salesforcer Logo"), Body = system.file("extdata", "logo.png", package = "salesforcer"), @@ -134,7 +134,7 @@ test_that("testing REST API Functionality", { expect_equal(names(attachment_records), c("id", "success", "errors")) expect_equal(nrow(attachment_records), 1) expect_true(attachment_records$success) - + # sf_update_attachment ------------------------------------------------------- temp_f <- tempfile(fileext = ".zip") zipr(temp_f, system.file("extdata", "logo.png", package = "salesforcer")) @@ -146,19 +146,19 @@ test_that("testing REST API Functionality", { expect_equal(names(attachment_records_update), c("id", "success", "errors")) expect_equal(nrow(attachment_records_update), 1) expect_true(attachment_records_update$success) - + # sf_delete_attachment ------------------------------------------------------- deleted_attachments <- sf_delete_attachment(attachment_records$id, api_type = "REST") expect_is(deleted_attachments, "tbl_df") - expect_equal(names(deleted_attachments), c("id", "success")) + expect_equal(names(deleted_attachments), c("id", "success", "errors")) expect_equal(nrow(deleted_attachments), 1) expect_true(deleted_attachments$success) - + # sf_delete ------------------------------------------------------------------ ids_to_delete <- unique(c(upserted_records$id[!is.na(upserted_records$id)], queried_records$Id)) deleted_records <- sf_delete(ids_to_delete, object_name = object, api_type = "REST") expect_is(deleted_records, "tbl_df") - expect_equal(names(deleted_records), c("id", "success")) + expect_equal(names(deleted_records), c("id", "success", "errors")) expect_equal(nrow(deleted_records), length(ids_to_delete)) expect_is(deleted_records$success, "logical") expect_true(all(deleted_records$success))