tests/testthat/test-yf_convert_to_wide.R

library(testthat)
library(yfR)

test_that(desc = "Test of yf_convert_to_wide()", {

  if (!covr::in_covr()) {
    skip_if_offline()
    skip_on_cran() # too heavy for cran
  }

  my_tickers <- c("^GSPC", "^BVSP")

  df <- yf_get(
    tickers = my_tickers,
    first_date = Sys.Date() - 30,
    last_date = Sys.Date(),
    be_quiet = TRUE
  )

  l_out <- yf_convert_to_wide(df)

  expect_true(length(l_out) > 1)
  expect_true(tibble::is_tibble(l_out[[1]]))
})

Try the yfR package in your browser

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

yfR documentation built on Feb. 16, 2023, 9:47 p.m.