tests/testthat/test_search_users.R

context("search_users")

test_that("search_users returns users data", {
  skip_on_cran()

  n <- 3
  token <- readRDS("twitter_tokens")
  x <- search_users("twitter", n = n, verbose = FALSE, token = token)

  expect_equal(is.data.frame(x), TRUE)
  expect_named(x)
  expect_true("user_id" %in% names(x))
  expect_gt(nrow(x), 2)
  expect_gt(ncol(x), 15)
  expect_true(all(c("text", "retweet_count") %in% names(x)))
  #expect_true(is.data.frame(attr(x, "tweets")))
  #expect_true(is.data.frame(tweets_data(x)))
  #expect_gt(nrow(tweets_data(x)), 0)
  #expect_gt(ncol(tweets_data(x)), 15)
  #expect_named(tweets_data(x))
})

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.