tests/testthat/test-convert_fips_to_names.R

test_that("It works", {
  state_1 <- convert_state_names(c("Alabama", "California", "Connecticut"),
                                 "abbr")
  expect_equal(state_1, c("AL", "CA", "CT"))
})

test_that("Warning works", {
  expect_warning(state_2 <- convert_state_names(c("DC", "AA", "MA"), "full"),
                 "One or more state names are wrong")
  expect_equal(state_2, c("District of Columbia", NA, "Massachusetts"))
})
GL-Li/mytoolbox documentation built on May 16, 2024, 4:29 p.m.