~hrbrmstr/reapr

4f2098a6c8fe6ec445d321b26ec7bf1cae19404b — boB Rudis 3 years ago c8ee6d1
basic tests & coverage
1 files changed, 20 insertions(+), 2 deletions(-)

M tests/testthat/test-reapr.R
M tests/testthat/test-reapr.R => tests/testthat/test-reapr.R +20 -2
@@ 1,6 1,24 @@
context("minimal package functionality")
context("URL reapig works")
test_that("we can do something", {

  #expect_that(some_function(), is_a("data.frame"))
  x <- reap_url("https://httpbin.org/")
  testthat::expect_equal(length(x), 11)

})

context("Node extraction & table reaping works")
test_that("we can do something", {

  x <- reap_url("https://en.wikipedia.org/wiki/List_of_Asian_countries_by_area")

  y <- reap_node(x, ".//table[contains(., 'including European part')]")
  testthat::expect_is(y, "xml_node")

  z <- reap_table(y)
  testthat::expect_is(z, "data.frame")

  a <- reap_table(x)
  testthat::expect_true(length(a) > 3)

})