Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed [#38](https://github.com/sportsdataverse/sportyR/issues/38) to natively support PWHL
- Added titles to documentation
- Fixed [#48](https://github.com/sportsdataverse/sportyR/issues/48) to update ggplot2 tests

# sportyR 2.2.2

Expand Down
15 changes: 6 additions & 9 deletions tests/testthat/test-plots-and-features-baseball.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a baseball field plot
mlb_field <- geom_baseball("mlb", rotation = -90)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(mlb_field)[1], "gg")
expect_equal(class(mlb_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(mlb_field))
}
)

Expand All @@ -14,9 +13,8 @@ test_that(
# Create a baseball field plot
little_league_field <- geom_baseball("little league", field_units = "m")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(little_league_field)[1], "gg")
expect_equal(class(little_league_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(little_league_field))
}
)

Expand All @@ -35,8 +33,7 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(ncaa_field)[1], "gg")
expect_equal(class(ncaa_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(ncaa_field))
}
)
18 changes: 7 additions & 11 deletions tests/testthat/test-plots-and-features-basketball.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nba_court)[1], "gg")
expect_equal(class(nba_court)[2], "ggplot")
expect_equal(class(ncaa_court)[1], "gg")
expect_equal(class(ncaa_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nba_court))
expect_true(ggplot2::is_ggplot(ncaa_court))
}
)

Expand All @@ -22,9 +20,8 @@ test_that(
# Create a basketball court plot
fiba_court <- geom_basketball("fiba", court_units = "ft", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(fiba_court)[1], "gg")
expect_equal(class(fiba_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(fiba_court))
}
)

Expand All @@ -43,8 +40,7 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(wnba_court)[1], "gg")
expect_equal(class(wnba_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(wnba_court))
}
)
15 changes: 6 additions & 9 deletions tests/testthat/test-plots-and-features-curling.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a curling sheet plot
wcf_sheet <- geom_curling("wcf")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(wcf_sheet)[1], "gg")
expect_equal(class(wcf_sheet)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(wcf_sheet))
}
)

Expand All @@ -14,9 +13,8 @@ test_that(
# Create a curling sheet plot
wcf_sheet <- geom_curling("wcf", sheet_units = "in", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(wcf_sheet)[1], "gg")
expect_equal(class(wcf_sheet)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(wcf_sheet))
}
)

Expand All @@ -31,8 +29,7 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(wcf_sheet)[1], "gg")
expect_equal(class(wcf_sheet)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(wcf_sheet))
}
)
15 changes: 6 additions & 9 deletions tests/testthat/test-plots-and-features-football.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a football field plot
nfl_field <- geom_football("nfl")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nfl_field)[1], "gg")
expect_equal(class(nfl_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nfl_field))
}
)

Expand All @@ -14,9 +13,8 @@ test_that(
# Create a football field plot
cfl_field <- geom_football("cfl", field_units = "m", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(cfl_field)[1], "gg")
expect_equal(class(cfl_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(cfl_field))
}
)

Expand All @@ -25,8 +23,7 @@ test_that(
# Create a football field plot
ncaa_field <- geom_football("ncaa")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(ncaa_field)[1], "gg")
expect_equal(class(ncaa_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(ncaa_field))
}
)
15 changes: 6 additions & 9 deletions tests/testthat/test-plots-and-features-hockey.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a hockey rink plot
nhl_rink <- geom_hockey("nhl")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nhl_rink)[1], "gg")
expect_equal(class(nhl_rink)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nhl_rink))
}
)

Expand All @@ -14,9 +13,8 @@ test_that(
# Create a hockey rink plot
iihf_rink <- geom_hockey("iihf", rink_units = "ft", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(iihf_rink)[1], "gg")
expect_equal(class(iihf_rink)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(iihf_rink))
}
)

Expand All @@ -35,8 +33,7 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(phf_rink)[1], "gg")
expect_equal(class(phf_rink)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(phf_rink))
}
)
20 changes: 8 additions & 12 deletions tests/testthat/test-plots-and-features-lacrosse.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a lacrosse field plot
nll_field <- geom_lacrosse("nll")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nll_field)[1], "gg")
expect_equal(class(nll_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nll_field))
}
)

Expand All @@ -14,9 +13,8 @@ test_that(
# Create a lacrosse field plot
ncaaw_field <- geom_lacrosse("ncaaw", field_units = "ft", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(ncaaw_field)[1], "gg")
expect_equal(class(ncaaw_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(ncaaw_field))
}
)

Expand All @@ -35,9 +33,8 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(pll_field)[1], "gg")
expect_equal(class(pll_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(pll_field))
}
)

Expand All @@ -56,8 +53,7 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(ncaam_field)[1], "gg")
expect_equal(class(ncaam_field)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(ncaam_field))
}
)
20 changes: 8 additions & 12 deletions tests/testthat/test-plots-and-features-soccer.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a soccer pitch plot
epl_pitch <- geom_soccer("epl")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(epl_pitch)[1], "gg")
expect_equal(class(epl_pitch)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(epl_pitch))
}
)

Expand All @@ -14,9 +13,8 @@ test_that(
# Create a soccer pitch plot
nwsl_pitch <- geom_soccer("nwsl", pitch_units = "in", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nwsl_pitch)[1], "gg")
expect_equal(class(nwsl_pitch)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nwsl_pitch))
}
)

Expand All @@ -30,9 +28,8 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nwsl_pitch)[1], "gg")
expect_equal(class(nwsl_pitch)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nwsl_pitch))
}
)

Expand Down Expand Up @@ -63,8 +60,7 @@ test_that(
)
)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(nwsl_pitch)[1], "gg")
expect_equal(class(nwsl_pitch)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(nwsl_pitch))
}
)
10 changes: 4 additions & 6 deletions tests/testthat/test-plots-and-features-tennis.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a tennis court plot
itf_court <- geom_tennis("itf")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(itf_court)[1], "gg")
expect_equal(class(itf_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(itf_court))
}
)

Expand All @@ -14,8 +13,7 @@ test_that(
# Create a tennis court plot
ita_court <- geom_tennis("ita", court_units = "m", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(ita_court)[1], "gg")
expect_equal(class(ita_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(ita_court))
}
)
10 changes: 4 additions & 6 deletions tests/testthat/test-plots-and-features-volleyball.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ test_that(
# Create a volleyball court plot
ncaa_court <- geom_volleyball("ncaa")

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(ncaa_court)[1], "gg")
expect_equal(class(ncaa_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(ncaa_court))
}
)

Expand All @@ -14,8 +13,7 @@ test_that(
# Create a volleyball court plot
fivb_court <- geom_volleyball("fivb", court_units = "ft", rotation = 270)

# Check the class of the resulting plot. This should be "gg" and "ggplot"
expect_equal(class(fivb_court)[1], "gg")
expect_equal(class(fivb_court)[2], "ggplot")
# Check the class of the resulting plot. This should be a ggplot object
expect_true(ggplot2::is_ggplot(fivb_court))
}
)
Loading