tests/testthat/test-oanda.R

test_that("oanda error handling ok", {
  expect_error(oanda("USD_JPY", apikey = NULL, from = "a", to = "b"), regexp = "value of 'from'")
  expect_error(oanda("usd_jpy", apikey = NULL, from = "2021-01-01", to = "b"), regexp = "value of 'to'")
  expect_error(oanda("USD-JPY", apikey = NULL, from = "2021-01-01", to = "2020-01-01"), regexp = "time period invalid")
  expect_error(oanda("usd-jpy", apikey = NULL, from = "a"), regexp = "value of 'from'")
  expect_error(oanda("USD_JPY", apikey = NULL, to = "b"), regexp = "value of 'to'")
})

test_that("oanda switch ok", {
  expect_message(expect_invisible(oanda_switch()), regexp = "switched to 'live'")
  expect_message(expect_invisible(oanda_switch()), regexp = "switched to 'practice'")
})

test_that("json deserialization works", {
  expect_type(ichimoku:::deserialize_json('{"k":"v"}'), "list")
})

Try the ichimoku package in your browser

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

ichimoku documentation built on Nov. 2, 2023, 5:36 p.m.