tests/testthat/test-espn_nba_game_rosters.R

test_that("ESPN - Get NBA game roster", {
  skip_on_cran()
  x <- espn_nba_game_rosters(game_id = 401283399)

  cols <- c(
    "athlete_id",
    "athlete_uid",
    "athlete_guid",
    "athlete_type",
    "sdr",
    "first_name",
    "last_name",
    "full_name",
    "athlete_display_name",
    "short_name",
    "weight",
    "display_weight",
    "height",
    "display_height",
    "age",
    "date_of_birth",
    "debut_year",
    "birth_place_city",
    "birth_place_state",
    "birth_place_country",
    "citizenship",
    "slug",
    "headshot_href",
    "headshot_alt",
    "jersey",
    "hand_type",
    "hand_abbreviation",
    "hand_display_value",
    "position_id",
    "position_name",
    "position_display_name",
    "position_abbreviation",
    "position_leaf",
    "linked",
    "years",
    "active",
    "contract_bird_status",
    "contract_active",
    "contract_active_1",
    "contract_incoming_trade_value",
    "contract_outgoing_trade_value",
    "contract_minimum_salary_exception",
    "contract_option_type",
    "contract_salary",
    "contract_salary_remaining",
    "contract_years_remaining",
    "contract_trade_kicker_active",
    "contract_trade_kicker_percentage",
    "contract_trade_kicker_value",
    "contract_trade_kicker_trade_value",
    "contract_trade_restriction",
    "contract_unsigned_foreign_pick",
    "contract_active_2",
    "draft_display_text",
    "draft_round",
    "draft_year",
    "draft_selection",
    "status_id",
    "status_name",
    "status_type",
    "status_abbreviation",
    "starter",
    "valid",
    "did_not_play",
    "display_name",
    "reason",
    "ejected",
    "team_id",
    "team_guid",
    "team_uid",
    "team_slug",
    "team_location",
    "team_name",
    "team_abbreviation",
    "team_display_name",
    "team_short_display_name",
    "team_color",
    "team_alternate_color",
    "team_is_active",
    "team_is_all_star",
    "logo_href",
    "logo_dark_href",
    "logos_href_2",
    "logos_href_3",
    "game_id",
    "order",
    "home_away",
    "winner",
    "contract_base_year_compensation_active",
    "contract_base_year_compensation_expiration"
  )
  expect_equal(colnames(x), cols)
  expect_s3_class(x, "data.frame")

})

Try the hoopR package in your browser

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

hoopR documentation built on Nov. 26, 2023, 1:07 a.m.