tests/testthat/test-nhl_player_stats.R

test_that("NHL - Get NHL Player Stats", {
  skip_on_cran()
  x <- nhl_player_stats(player_id=8476899)
  
  cols <- c("player_id",
            "full_name",
            "link",
            "first_name",
            "last_name",
            "primary_number",
            "birth_date",
            "current_age",
            "birth_city",
            "birth_state_province",
            "birth_country",
            "nationality",
            "height",
            "weight",
            "active",
            "alternate_captain",
            "captain",
            "rookie",
            "shoots_catches",
            "roster_status",
            "current_team_id",
            "current_team_name",
            "current_team_link",
            "primary_position_code",
            "primary_position_name",
            "primary_position_type",
            "primary_position_abbreviation",
            "season",
            "sequence_number",
            "stat_save_percentage",
            "stat_goal_against_average",
            "stat_games",
            "stat_time_on_ice",
            "stat_shutouts",
            "stat_ties",
            "stat_wins",
            "stat_losses",
            "stat_goals_against",
            "stat_saves",
            "stat_shots_against",
            "stat_ot",
            "stat_power_play_saves",
            "stat_short_handed_saves",
            "stat_even_saves",
            "stat_short_handed_shots",
            "stat_even_shots",
            "stat_power_play_shots",
            "stat_games_started",
            "stat_power_play_save_percentage",
            "stat_short_handed_save_percentage",
            "stat_even_strength_save_percentage",
            "team_name",
            "team_link",
            "team_id",
            "team_abbreviation",
            "team_team_name",
            "team_location_name",
            "team_first_year_of_play",
            "team_short_name",
            "team_official_site_url",
            "team_franchise_id",
            "team_active",
            "team_venue_id",
            "team_venue_name",
            "team_venue_link",
            "team_venue_city",
            "team_venue_time_zone_id",
            "team_venue_time_zone_offset",
            "team_venue_time_zone_tz",
            "team_division_id",
            "team_division_name",
            "team_division_name_short",
            "team_division_link",
            "team_division_abbreviation",
            "team_conference_id",
            "team_conference_name",
            "team_conference_link",
            "team_franchise_franchise_id",
            "team_franchise_team_name",
            "team_franchise_link",
            "league_name",
            "league_link",
            "league_id",
            "split_type",
            "stat_time_on_ice_per_game")
  
  expect_equal(colnames(x), cols)
  expect_s3_class(x, 'data.frame')
  
})
benhowell71/fastRhockey documentation built on March 1, 2024, 9:23 a.m.