tests/testthat/test-rail-path.R

test_that("rail path returned on same line", {
  skip_if_no_key()
  Sys.sleep(0.11)
  p <- rail_path("A08", "A02")
  expect_length(p, 5)
  expect_s3_class(p, "data.frame")
  expect_type(p$DistanceToPrev, "integer")
})

test_that("rail path errors for stations on different lines", {
  skip_if_no_key()
  Sys.sleep(0.11)
  expect_error(rail_path("A02", "N01"))
})

Try the metro package in your browser

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

metro documentation built on Nov. 2, 2023, 6:06 p.m.