tests/testthat/test-get_downloads_page_data.R

test_that(
  "`get_downloads_page_data()` runs without error for `project_id` = 'gtex' (which returns no results)",
  {
    expect_equal(
      with_mocked_bindings(
        code = get_downloads_page_data("gtex"),
        perform_gtex_request_json = function(...) {
          list(data = list())
        }
      ),
      tibble::tibble()
    )
  }
)

test_that("`get_downloads_page_data()` returns tibble with expected colnames", {
  skip_if_offline()
  result <- get_downloads_page_data("adult-gtex")

  expect_s3_class(result, "tbl_df")

  expect_identical(
    names(result),
    c(
      "name",
      "displayName",
      "description",
      "order",
      "parent",
      "children"
    )
  )
})

Try the gtexr package in your browser

Any scripts or data that you put into this service are public.

gtexr documentation built on June 8, 2025, 10:26 a.m.