test: smoke test cog_gov_search basket -> cog_spending pipe

Confirms a basket result pipes cleanly into the existing query verb
without any input-coercion friction.
This commit is contained in:
2026-04-28 12:10:28 -04:00
parent 56fdd8e5b9
commit 7475696853
+12
View File
@@ -116,3 +116,15 @@ test_that("cog_spending rejects data.frame without canonical_govid column", {
bad <- tibble::tibble(foo = "bar")
expect_error(cog_spending(bad, 2020L), "canonical_govid")
})
test_that("cog_spending accepts a basket-mode cog_gov_search result", {
skip_if_no_corpus()
basket <- cog_gov_search(
name = c("BROWARD COUNTY", "SAN DIEGO COUNTY"),
state = c("FL", "CA")
)
expect_equal(nrow(basket), 2L)
spending <- cog_spending(basket, years = 2019:2020, category = "Police")
expect_s3_class(spending, "tbl_df")
expect_setequal(unique(spending$canonical_govid), basket$canonical_govid)
})