tests/testthat/test_get_trends_closest.R

context("trends_available")

test_that("get_trends_closest returns data frame with correct city name", {
  skip_on_cran()

  token <- readRDS("twitter_tokens")
  x <- get_trends(lat = 40.7, lng = -74.0, token = token)

  expect_true(is.data.frame(x))
  expect_named(x)
  expect_true(all(c("trend", "woeid") %in% names(x)))
  expect_gt(nrow(x), 5)
  expect_gt(ncol(x), 2)
  expect_equal(as.character(x[1,]$place), "New York")
})

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.