Running ‘spelling.R’
  Running ‘testthat.R’ [13s/64s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # Load necessary libraries
  > library(nettskjemar)
  > library(testthat)
  > 
  > test_check("nettskjemar")
  [ FAIL 16 | WARN 0 | SKIP 0 | PASS 88 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-ns-attachment.R:4:5'): ns_get_attachment saves an attachment file ──
  Error in `httr2::resp_body_raw(resp)`: Can't retrieve empty body.
  Backtrace:
      ▆
   1. ├─vcr::use_cassette(...) at test-ns-attachment.R:2:3
   2. │ └─cassette$call_block(...)
   3. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-attachment.R:4:5
   4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
   5. └─nettskjemar::ns_get_attachment(attachment_id, path = temp_file)
   6.   ├─base::writeBin(httr2::resp_body_raw(resp), path)
   7.   └─httr2::resp_body_raw(resp)
   8.     └─cli::cli_abort("Can't retrieve empty body.")
   9.       └─rlang::abort(...)
  ── Error ('test-ns-attachment.R:18:5'): ns_list_form_attachments retrieves metadata ──
  Error in `split.default(x, g)`: first argument must be a vector
  Backtrace:
      ▆
   1. ├─vcr::use_cassette(...) at test-ns-attachment.R:17:3
   2. │ └─cassette$call_block(...)
   3. ├─nettskjemar:::with_mocked_nettskjema_auth(result <- ns_list_form_attachments(form_id)) at test-ns-attachment.R:18:5
   4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
   5. └─nettskjemar::ns_list_form_attachments(form_id)
   6.   └─stats::ave(ids$submissionId, ids$submissionId, FUN = seq_along)
   7.     ├─base::lapply(split(x, g), FUN)
   8.     ├─base::split(x, g)
   9.     └─base::split.default(x, g)
  ── Error ('test-ns-attachment.R:34:5'): ns_get_form_attachments saves attachments ──
  Error in `split.default(x, g)`: first argument must be a vector
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-attachment.R:31:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-attachment.R:34:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_form_attachments(...)
    6.   └─nettskjemar::ns_list_form_attachments(form_id)
    7.     └─stats::ave(ids$submissionId, ids$submissionId, FUN = seq_along)
    8.       ├─base::lapply(split(x, g), FUN)
    9.       ├─base::split(x, g)
   10.       └─base::split.default(x, g)
  ── Error ('test-ns-attachment.R:52:5'): Retrieves submission attachment metadata ──
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "form", "submission", submission_id)))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-attachment.R:51:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(result <- ns_list_submission_attachments(submission_id)) at test-ns-attachment.R:52:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_list_submission_attachments(submission_id)
    6.   └─nettskjemar::ns_get_submission(submission_id)
    7.     └─httr2::resp_body_json(...)
    8.       └─httr2::resp_check_content_type(...)
    9.         └─httr2:::check_content_type(...)
   10.           └─cli::cli_abort(...)
   11.             └─rlang::abort(...)
  ── Error ('test-ns-attachment.R:67:5'): ns_get_submission_attachments saves  sub attch ──
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "form", "submission", submission_id)))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-attachment.R:65:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-attachment.R:67:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_submission_attachments(...)
    6.   └─nettskjemar::ns_list_submission_attachments(submission_id)
    7.     └─nettskjemar::ns_get_submission(submission_id)
    8.       └─httr2::resp_body_json(...)
    9.         └─httr2::resp_check_content_type(...)
   10.           └─httr2:::check_content_type(...)
   11.             └─cli::cli_abort(...)
   12.               └─rlang::abort(...)
  ── Error ('test-ns-codebook.R:3:5'): fetches raw codebook correctly ────────────
  Error in `httr2::resp_body_json(resp)`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-codebook.R:2:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(raw_cb <- get_raw_codebook(form_id)) at test-ns-codebook.R:3:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar:::get_raw_codebook(form_id)
    6.   ├─base::structure(...)
    7.   └─httr2::resp_body_json(resp)
    8.     └─httr2::resp_check_content_type(...)
    9.       └─httr2:::check_content_type(...)
   10.         └─cli::cli_abort(...)
   11.           └─rlang::abort(...)
  ── Failure ('test-ns-codebook.R:15:5'): handles invalid form_id gracefully ─────
  `get_raw_codebook(100)` threw an error with unexpected message.
  Expected match: "Not Found"
  Actual message: "Unexpected content type \"NA\".\n• Expecting type \"application/json\" or suffix \"json\"."
  Backtrace:
       ▆
    1. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-codebook.R:15:5
    2. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    3. ├─testthat::expect_error(get_raw_codebook(100), "Not Found")
    4. │ └─testthat:::quasi_capture(...)
    5. │   ├─testthat (local) .capture(...)
    6. │   │ └─base::withCallingHandlers(...)
    7. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
    8. └─nettskjemar:::get_raw_codebook(100)
    9.   ├─base::structure(...)
   10.   └─httr2::resp_body_json(resp)
   11.     └─httr2::resp_check_content_type(...)
   12.       └─httr2:::check_content_type(...)
   13.         └─cli::cli_abort(...)
   14.           └─rlang::abort(...)
  ── Error ('test-ns-codebook.R:24:5'): converts raw to structured ───────────────
  Error in `httr2::resp_body_json(resp)`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-codebook.R:23:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(cb <- ns_get_codebook(form_id)) at test-ns-codebook.R:24:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_codebook(form_id)
    6.   └─nettskjemar:::get_raw_codebook(form_id = form_id)
    7.     ├─base::structure(...)
    8.     └─httr2::resp_body_json(resp)
    9.       └─httr2::resp_check_content_type(...)
   10.         └─httr2:::check_content_type(...)
   11.           └─cli::cli_abort(...)
   12.             └─rlang::abort(...)
  ── Error ('test-ns-codebook.R:35:5'): respects asis flag ───────────────────────
  Error in `httr2::resp_body_json(resp)`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-codebook.R:34:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-codebook.R:35:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_codebook(form_id, asis = TRUE)
    6.   └─nettskjemar:::get_raw_codebook(form_id = form_id)
    7.     ├─base::structure(...)
    8.     └─httr2::resp_body_json(resp)
    9.       └─httr2::resp_check_content_type(...)
   10.         └─httr2:::check_content_type(...)
   11.           └─cli::cli_abort(...)
   12.             └─rlang::abort(...)
  ── Error ('test-ns-form.R:3:5'): test get forms list ───────────────────────────
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "form", "me")))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-form.R:2:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(formslist <- ns_get_forms()) at test-ns-form.R:3:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_forms()
    6.   └─httr2::resp_body_json(...)
    7.     └─httr2::resp_check_content_type(...)
    8.       └─httr2:::check_content_type(...)
    9.         └─cli::cli_abort(...)
   10.           └─rlang::abort(...)
  ── Error ('test-ns-form.R:36:5'): test get raw forms list ──────────────────────
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "form", "me")))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-form.R:35:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(formslist_raw <- ns_get_forms(asis = TRUE)) at test-ns-form.R:36:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_forms(asis = TRUE)
    6.   └─httr2::resp_body_json(...)
    7.     └─httr2::resp_check_content_type(...)
    8.       └─httr2:::check_content_type(...)
    9.         └─cli::cli_abort(...)
   10.           └─rlang::abort(...)
  ── Error ('test-ns-me.R:3:5'): test user information ───────────────────────────
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "me")))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-me.R:2:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(me <- ns_get_me()) at test-ns-me.R:3:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_me()
    6.   └─httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), "me")))
    7.     └─httr2::resp_check_content_type(...)
    8.       └─httr2:::check_content_type(...)
    9.         └─cli::cli_abort(...)
   10.           └─rlang::abort(...)
  ── Error ('test-ns-meta.R:3:5'): ns_get_meta for valid input ───────────────────
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "form", form_id, "info")))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-meta.R:2:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(meta <- ns_get_meta(form_id)) at test-ns-meta.R:3:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_meta(form_id)
    6.   └─httr2::resp_body_json(...)
    7.     └─httr2::resp_check_content_type(...)
    8.       └─httr2:::check_content_type(...)
    9.         └─cli::cli_abort(...)
   10.           └─rlang::abort(...)
  ── Failure ('test-ns-meta.R:26:5'): ns_get_meta invalid form_id ────────────────
  `ns_get_meta(100)` threw an error with unexpected message.
  Expected match: "Not Found"
  Actual message: "Unexpected content type \"NA\".\n• Expecting type \"application/json\" or suffix \"json\"."
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-meta.R:25:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-meta.R:26:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. ├─testthat::expect_error(ns_get_meta(100), "Not Found")
    6. │ └─testthat:::quasi_capture(...)
    7. │   ├─testthat (local) .capture(...)
    8. │   │ └─base::withCallingHandlers(...)
    9. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
   10. └─nettskjemar::ns_get_meta(100)
   11.   └─httr2::resp_body_json(...)
   12.     └─httr2::resp_check_content_type(...)
   13.       └─httr2:::check_content_type(...)
   14.         └─cli::cli_abort(...)
   15.           └─rlang::abort(...)
  ── Error ('test-ns-submission.R:3:5'): ns_get_data retrieves data in original format ──
  Error in `resp_body_raw(resp)`: Can't retrieve empty body.
  Backtrace:
      ▆
   1. ├─vcr::use_cassette(...) at test-ns-submission.R:2:3
   2. │ └─cassette$call_block(...)
   3. ├─nettskjemar:::with_mocked_nettskjema_auth(...) at test-ns-submission.R:3:5
   4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
   5. └─nettskjemar::ns_get_data(form_id, type = "original")
   6.   └─httr2::resp_body_string(...)
   7.     └─httr2::resp_body_raw(resp)
   8.       └─cli::cli_abort("Can't retrieve empty body.")
   9.         └─rlang::abort(...)
  ── Error ('test-ns-submission.R:16:5'): ns_get_submission retrieves individual submission ──
  Error in `httr2::resp_body_json(httr2::req_perform(httr2::req_url_path_append(ns_req(), 
      "form", "submission", submission_id)))`: Unexpected content type "NA".
  • Expecting type "application/json" or suffix "json".
  Backtrace:
       ▆
    1. ├─vcr::use_cassette(...) at test-ns-submission.R:15:3
    2. │ └─cassette$call_block(...)
    3. ├─nettskjemar:::with_mocked_nettskjema_auth(result <- ns_get_submission(submission_id)) at test-ns-submission.R:16:5
    4. │ └─base::force(expr) at tests/testthat/helpers.R:28:3
    5. └─nettskjemar::ns_get_submission(submission_id)
    6.   └─httr2::resp_body_json(...)
    7.     └─httr2::resp_check_content_type(...)
    8.       └─httr2:::check_content_type(...)
    9.         └─cli::cli_abort(...)
   10.           └─rlang::abort(...)
  
  [ FAIL 16 | WARN 0 | SKIP 0 | PASS 88 ]
  Error: Test failures
  Execution halted