tests/testthat/test-api-hypothesis.R

test_that("hypothesis_api() can be generated", {
    api <- expect_error(hypothesis_api(), NA)
    expect_named(api, c("api", "ops"))
    expect_is(api, "hypothesis_api")
})

test_that("hypothesis_search_annotations() works", {
    search <- expect_error(hypothesis_search_annotations(), NA)
    expect_is(search, "hypothesis_api_response")
    expect_named(search, c("total", "rows"))
})

test_that("hypothesis_get_annotations() works", {
    annotations <- expect_error(hypothesis_get_annotations(rows_limit = 400), NA)
    expect_is(annotations, "hypothesis_annotations")
    expect_length(annotations, 400)
})

test_that("hypothesis_process_annotations() works", {
    annotations <- hypothesis_get_annotations(rows_limit = 200)
    annotations <- expect_error(hypothesis_process_annotations(annotations), NA)
    expect_is(annotations, "tbl_df")
    expect_equal(nrow(annotations), 200L)
})

test_that("hypothesis_annotations() works", {
    annotations <- expect_error(hypothesis_annotations(rows_limit = 200), NA)
    expect_is(annotations, "tbl_df")
    expect_equal(nrow(annotations), 200L)
})

test_that("hypothesis_annotations_markdown() works", {
    annotations <- hypothesis_annotations(rows_limit = 200)
    markdown <- expect_error(hypothesis_annotations_markdown(annotations), NA)
    expect_is(markdown, "character")
})
tjpalanca/tjutils documentation built on Jan. 20, 2021, 2:01 p.m.