diff --git a/R/search_contacts.R b/R/search_contacts.R index a9de7fd..0babf9a 100644 --- a/R/search_contacts.R +++ b/R/search_contacts.R @@ -15,7 +15,7 @@ search_contacts <- function(user_code, api_token, search_term = "") { warning("Please add a valid user code") } else if (missing(api_token)) { warning("Please add a valid API token") - } else + } else { tryCatch( { r <- get_request(user_code = user_code, @@ -95,6 +95,7 @@ search_contacts <- function(user_code, api_token, search_term = "") { select(-result_email, -result_phone, -result_website, -result_address, -result_contact_custom_fields, -result_custom_fields) return(contenido) + } } diff --git a/tests/testthat/test-credentials.R b/tests/testthat/test-credentials.R index c1639ac..f997fc5 100644 --- a/tests/testthat/test-credentials.R +++ b/tests/testthat/test-credentials.R @@ -20,7 +20,7 @@ testthat::test_that("Contact information error message with invalid credentials" contact_id = "Fulano")) }) -testthat::test_that("Contact information error message with invalid credentials", { +testthat::test_that("Search contacts error message with invalid credentials", { expect_error(search_contacts(user_code = "6A6E88", api_token = "TQ9XM", search_term = "brenesii")) diff --git a/tests/testthat/test-error-warning-msg.R b/tests/testthat/test-error-warning-msg.R index 13aced0..2f86980 100644 --- a/tests/testthat/test-error-warning-msg.R +++ b/tests/testthat/test-error-warning-msg.R @@ -20,9 +20,9 @@ testthat::test_that("Invalid credentials", { ) expect_warning( - get_pipeline_report(user_code = "6A6E88", - api_token = "96066"), - "Please add a valid pipeline ID" + search_contacts(user_code = "6A6E88", + search_term = "ixpantia"), + "Please add a valid API token" ) })