tests/testthat/test-cfbd_live_scoreboard.R

cols <- c(
  "game_id",
  "start_date",
  "start_time_tbd",
  "tv",
  "neutral_site",
  "conference_game",
  "status",
  "period",
  "clock",
  "situation",
  "possession",
  "last_play",
  "venue_name",
  "venue_city",
  "venue_state",
  "home_team_id",
  "home_team_name",
  "home_team_conference",
  "home_team_classification",
  "home_team_points",
  # Per-quarter line-score columns are dynamic: they only appear once
  # the game reaches the corresponding quarter (Q1 is universal, but
  # Q2-Q4 require live games to have progressed). Asserting on Q1 alone
  # keeps the schema check meaningful without breaking during Q1
  # in-progress games.
  "home_team_line_scores_Q1",
  "home_team_win_probability",
  "away_team_id",
  "away_team_name",
  "away_team_conference",
  "away_team_classification",
  "away_team_points",
  "away_team_line_scores_Q1",
  "away_team_win_probability",
  "weather_temperature",
  "weather_description",
  "weather_wind_speed",
  "weather_wind_direction",
  "betting_spread",
  "betting_over_under",
  "betting_home_moneyline",
  "betting_away_moneyline"
)

test_that("CFB Live Scoreboard", {
  skip_on_cran()
  x <- cfbd_live_scoreboard(division='fbs', conference = "B12")
  if (is.null(x) || !is.data.frame(x) || nrow(x) == 0L) {
    skip("CFBD rate-limited or returned no rows")
  }

  y <- cfbd_live_scoreboard(division='fbs')
  if (is.null(y) || !is.data.frame(y) || nrow(y) == 0L) {
    skip("CFBD rate-limited or returned no rows")
  }
  expect_in(cols, colnames(x))
  expect_in(cols, colnames(y))
  expect_s3_class(x, "data.frame")
  expect_s3_class(y, "data.frame")
})

Try the cfbfastR package in your browser

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

cfbfastR documentation built on Aug. 24, 2026, 5:13 p.m.