tests/testthat/test.nhl_tournaments.R

context("nhl_tournaments")

testthat::test_that(
  "nhl_tournaments_playoffs has correct names", {
    testthat::skip_if_offline(host = "nhl.com")
    testthat::skip_if(skipRemoteTests)

    res <- nhl_tournaments_playoffs(2015L)[[1L]]
    testthat::expect_true(all(is.element(
      c("copyright", "id", "name", "season", "defaultRound", "rounds"),
      names(res)
    )))
  }
)

testthat::test_that(
  "nhl_tournaments_olympics has correct names", {
    testthat::skip_if_offline(host = "nhl.com")
    testthat::skip_if(skipRemoteTests)

    res <- nhl_tournaments_olympics(2009)[[1L]]
    testthat::expect_true(all(is.element(
      c("copyright", "id", "name", "season"),
      names(res)
    )))
  }
)

testthat::test_that(
  "nhl_tournaments_worldcups has correct names", {
    testthat::skip_if_offline(host = "nhl.com")
    testthat::skip_if(skipRemoteTests)

    res <- nhl_tournaments_worldcups(2003L)[[1L]]
    testthat::expect_true(all(is.element(
      c("copyright", "id", "name", "season", "rounds"),
      names(res)
    )))
  }
)

Try the nhlapi package in your browser

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

nhlapi documentation built on Feb. 20, 2021, 9:06 a.m.