tests/testthat/test-boe_consumer_credit.R

test_that("boe_consumer_credit() returns expected structure", {
  skip_on_cran()
  skip_if_offline()

  out <- boe_consumer_credit(from = "2024-01-01", to = "2024-06-30")

  expect_s3_class(out, "data.frame")
  expect_named(out, c("date", "type", "amount_gbp_m"))
  expect_true(nrow(out) > 0)
  expect_true(all(out$type %in% c("total", "credit_card", "other")))
})

test_that("boe_consumer_credit() type filter works", {
  skip_on_cran()
  skip_if_offline()

  out <- boe_consumer_credit(type = "credit_card", from = "2024-01-01", to = "2024-06-30")
  expect_true(all(out$type == "credit_card"))
})

Try the boe package in your browser

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

boe documentation built on March 12, 2026, 5:07 p.m.