tests/testthat/test-price.R

test_that("aemo_price validates region", {
  expect_error(aemo_price("ACT1", "2024-06-01", "2024-06-02"))
})

test_that("aemo_price validates interval", {
  expect_error(aemo_price("NSW1", "2024-06-01", "2024-06-02", interval = "1min"))
})

test_that("aemo_price requires end >= start", {
  expect_error(aemo_price("NSW1", "2024-06-02", "2024-06-01"))
})

test_that("aemo_price live fetch", {
  skip_on_cran()
  skip_if_offline()
  skip_if(Sys.getenv("AEMO_LIVE_TESTS") != "true",
          "Live network tests disabled by default.")

  p <- aemo_price("NSW1", "2024-06-01", "2024-06-01 01:00:00")
  expect_s3_class(p, "aemo_tbl")
})

Try the aemo package in your browser

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

aemo documentation built on April 29, 2026, 1:07 a.m.