library(testthat) library(kickR) # Bundesliga # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_bundesliga_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 18) }) # Premier League # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_epl_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 20) }) # Eredivisie # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_eredivisie_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 18) }) # La Liga # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_la_liga_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 20) }) # Ligue 1 # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_ligue1_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 20) }) # Primeira Liga # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_primeira_liga_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 18) }) # Serie A # Test for a valid season and type test_that("Fetching data for a valid season and type", { result <- fbref_serie_a_team_stats(season = "2022/2023", type = "standard") expect_is(result, "data.frame") expect_equal(ncol(result), 32) expect_equal(nrow(result), 20) }) # T5 leagues players # Test to check if the number of rows returned is more than 1500 test_that("Fetching data with more than 1500 rows", { result <- fbref_big5_player_stats(season = "2022/2023", type = "possession") expect_is(result, "data.frame") expect_equal(ncol(result), 30) expect_true(nrow(result) > 1500) })