Running ‘testthat.R’ [7s/28s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/tests.html
  > # * https://testthat.r-lib.org/reference/test_package.html#special-files
  > 
  > library(testthat)
  > library(fqar)
  > 
  > test_check("fqar")
  data_set must be a dataframe obtained from the universalFQA.org website. Type ?download_transect for help.
  data_set must be a dataframe obtained from the universalFQA.org website. Type ?download_transect for help.
  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 363 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-download_database.R:10:3'): download_database works ────────────
  Error in `(function (database_id) 
  {
      if (!is.numeric(database_id)) {
          stop("database_id must be an integer.", call. = FALSE)
      }
      if (database_id%%1 != 0) {
          stop("database_id must be an integer.", call. = FALSE)
      }
      empty <- data.frame(V1 = character(0), V2 = character(0), 
          V3 = character(0), V4 = character(0), V5 = character(0), 
          V6 = character(0), V7 = character(0), V8 = character(0), 
          V9 = character(0))
      class(empty) <- c("tbl_df", "tbl", "data.frame")
      if (database_id == -40000) {
          return(invisible(empty))
      }
      database_address <- paste0("http://universalfqa.org/get/database/", 
          database_id)
      ua <- httr::user_agent("https://github.com/equitable-equations/fqar")
      database_get <- tryCatch(httr::GET(database_address, ua, 
          timeout(2)), error = function(e) {
          message("No response from universalFQA.org. Please check internet connection.")
          character(0)
      })
      cl <- class(database_get)
      if (cl != "response") {
          return(invisible(empty))
      }
      if (httr::http_error(database_get)) {
          message(paste("API request to universalFQA.org failed. Error", 
              httr::status_code(assessments_get)))
          return(invisible(empty))
      }
      database_text <- httr::content(database_get, "text", encoding = "ISO-8859-1")
      database_json <- jsonlite::fromJSON(database_text)
      list_data <- database_json[[2]]
      if ((list_data[[1]] == "The requested assessment is not public") & 
          (!is.na(list_data[[1]]))) {
          message("The requested assessment is not public.")
          return(invisible(empty))
      }
      max_length <- max(unlist(lapply(list_data, length)))
      list_data <- lapply(list_data, function(x) {
          length(x) <- max_length
          unlist(x)
      })
      db_out <- as.data.frame(do.call(rbind, list_data))
      if (db_out[5, 2] == 0) {
          message("Specified database is empty.")
      }
      class(db_out) <- c("tbl_df", "tbl", "data.frame")
      db_out
  })(database_id = database_id)`: object 'assessments_get' not found
  Backtrace:
       ▆
    1. ├─testthat::expect_message(download_database(3)) at test-download_database.R:10:3
    2. │ └─testthat:::expect_condition_matching(...)
    3. │   └─testthat:::quasi_capture(...)
    4. │     ├─testthat (local) .capture(...)
    5. │     │ └─base::withCallingHandlers(...)
    6. │     └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    7. └─fqar::download_database(3)
    8.   ├─fqar:::download_database_internal(database_id)
    9.   │ ├─base::withVisible(eval(mc, parent.frame()))
   10.   │ └─base::eval(mc, parent.frame())
   11.   │   └─base::eval(mc, parent.frame())
   12.   └─fqar (local) `<fn>`(database_id = database_id)
   13.     ├─base::message(...)
   14.     ├─base::paste(...)
   15.     └─httr::status_code(assessments_get)
  ── Error ('test-species_acronym.R:14:3'): species_acronym works ────────────────
  Error: parse error: unallowed token at this point in JSON text
            tatus" : "success", "data" : }
                       (right here) ------^
  
  Backtrace:
       ▆
    1. ├─base::suppressMessages(download_database(149)) at test-species_acronym.R:14:3
    2. │ └─base::withCallingHandlers(...)
    3. └─fqar::download_database(149)
    4.   ├─fqar:::download_database_internal(database_id)
    5.   │ ├─base::withVisible(eval(mc, parent.frame()))
    6.   │ └─base::eval(mc, parent.frame())
    7.   │   └─base::eval(mc, parent.frame())
    8.   └─fqar (local) `<fn>`(database_id = database_id)
    9.     └─jsonlite::fromJSON(database_text)
   10.       └─jsonlite:::parse_and_simplify(...)
   11.         └─jsonlite:::parseJSON(txt, bigint_as_char)
   12.           └─jsonlite:::parse_string(txt, bigint_as_char)
  
  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 363 ]
  Error: Test failures
  Execution halted