tests/testthat/test-price.R

context("Test the ticker.")

test_that("Data is returned as a named numeric value.", {
  valid_codes = c("USD", "btc", "eTh", "BnB")
  for (code in valid_codes) {
    p = price(code)
    expect_named(p, toupper(code))
    expect_type(p, "double")
  }
})

test_that("Errors around invalid codes are handled.", {
  expect_error(price("XRP"), "^Invalid currency code")
})
froocpu/stellaR documentation built on May 17, 2019, 7:05 p.m.