tests/testthat/test-get_matchups.R

# Unit tests for get_matchups function

# Test 1: Invalid week type informs user
test_that("invalid week type informs user and returns nothing", {
  expect_error(get_matchups(688281863499907072, "2"), "week paramater must be numeric")
})

# Test 2: Valid league ID and matchup week returns a data frame
test_that("Valid league ID and matchup week returns a data frame", {
  expect_equal(class(get_matchups(688281863499907072, 2)), "data.frame")
})

Try the sleeperapi package in your browser

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

sleeperapi documentation built on April 3, 2025, 6:13 p.m.