tests/testthat/test_get_trends.R

context("get_trends")


test_that("get_trends returns trends data", {
  skip_on_cran()

  token <- readRDS("twitter_tokens")
  x <- get_trends(token = token)

  expect_true(is.data.frame(x))
  expect_named(x)
  expect_true(all(c("trend", "promoted_content") %in% names(x)))
  expect_gt(nrow(x), 10)
  expect_gt(ncol(x), 5)
  expect_equal(check_woeid("world"), "1")
  expect_equal(check_woeid("kansas"), "2347575")
  expect_equal(check_woeid("new york"), "2347591")
})

Try the rtweet package in your browser

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

rtweet documentation built on Jan. 11, 2020, 9:11 a.m.