Skip to content

Commit

Permalink
Add additional test for row filters with no column selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Moohan committed Jan 15, 2025
1 parent 647184b commit 9369fea
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/testthat/test-get_resource.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,35 @@ test_that("returns data for multiple filters in mixed format", {
expect_length(unique(delays$MonthOfDelay), 13)
})

test_that("returns data for multiple filters for all columns", {
prescriptions <- get_resource(
res_id = "d1fbede3-98c4-436e-9e75-2ed807a36075",
row_filters = list("HBT" = "S08000015",
"DMDCode" = c("940711000001101", "1004511000001101", "1014311000001109"))
)

expect_s3_class(prescriptions, "tbl_df")
expect_equal(nrow(prescriptions), 114)
expect_named(prescriptions, c(
"HBT",
"GPPractice",
"DMDCode",
"BNFItemCode",
"BNFItemDescription",
"PrescribedType",
"NumberOfPaidItems",
"PaidQuantity",
"GrossIngredientCost",
"PaidDateMonth"
))
expect_length(unique(prescriptions$GPPractice), 55)
expect_setequal(
prescriptions$DMDCode,
c("940711000001101", "1004511000001101", "1014311000001109")
)
expect_setequal(prescriptions$HBT, "S08000015")
})

test_that("errors on invalid filters", {
# non-existent column in row_filters
expect_error(
Expand Down

0 comments on commit 9369fea

Please sign in to comment.