From 7475696853897af1cdbd8034ee6d0775a55730cb Mon Sep 17 00:00:00 2001 From: Jared Knowles Date: Tue, 28 Apr 2026 12:10:28 -0400 Subject: [PATCH] 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. --- tests/testthat/test-spending.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testthat/test-spending.R b/tests/testthat/test-spending.R index 89cf731..3d39f19 100644 --- a/tests/testthat/test-spending.R +++ b/tests/testthat/test-spending.R @@ -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) +})