tests/testthat/test_fhir_body.R

testthat::test_that(
	"methods for fhir_body() create identical results", {
		b1 <- fhir_body(content = "gender=female&_summary=count", type="application/x-www-form-urlencoded")
		b2 <- fhir_body(content = list("gender"="female", "_summary"= "count"))
		testthat::expect_identical(b1, b2)
	}
)

testthat::test_that(
	"errors are thrown for incorrect input", {
		testthat::expect_error(fhir_body(content = "a"))
		testthat::expect_error(fhir_body(content = c("a", "b"), type="a"))
	}
)

Try the fhircrackr package in your browser

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

fhircrackr documentation built on Feb. 16, 2023, 8:33 p.m.