tests/testthat/test-get_league_drafts.R

# Tests for get_league_drafts function

# Test 1: Invalid league ID returns a message informing user
test_that("Invalid league ID returns a message informing user", {
  expect_message(get_league_drafts(-777), "No data found - was the league ID entered correctly?")
})

# Test 2: Valid league ID returns a data frame
test_that("Valid league ID returns a data frame", {
  expect_equal(class(get_league_drafts(688281863499907072)), "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.