tests/testthat/test-amendment.R

with_mock_dir("t/amendment", {
  test_that("cong_amendment works", {
    x <- cong_amendment()
    expect_s3_class(x, 'tbl_df')
  })
})

with_mock_dir("t/amend1", {
  test_that("cong_amendment with item works", {
    x <- cong_amendment(congress = 117, type = 'samdt', number = 2137, item = 'actions')
    expect_s3_class(x, 'tbl_df')
  })
})

with_mock_dir("t/amend2", {
  test_that("cong_amendment without item works", {
    x <- cong_amendment(congress = 117, type = 'samdt', number = 2137)
    expect_s3_class(x, 'tbl_df')
  })
})

test_that("cong_amendment errors with from_date missing to_date", {
  expect_error(cong_amendment(from_date = '2023-05-05'))
})

Try the congress package in your browser

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

congress documentation built on May 29, 2024, 2:37 a.m.