tests/testthat/test-table_updateSingleRecord.R

context("table_updateSingleRecord")

test_that("table_updateSingleRecord() works", {
  locationTbl <- get(data("wa_monitors_500"))
  
  wenatcheeRecord <- locationTbl %>% dplyr::filter(city == "Wenatchee")
  wenatcheeID <- wenatcheeRecord$locationID
  wenatcheeOldName <- wenatcheeRecord$locationName
  
  testTbl <- table_updateSingleRecord(
    locationTbl,
    locationList = list(
      locationID = wenatcheeID,
      locationName = "Wenatchee-Fifth St"
    )
  )

  wenatcheeNewName <- 
    testTbl %>% 
    dplyr::filter(city == "Wenatchee") %>%
    dplyr::pull(locationName)
  
  expect_equal(wenatcheeOldName, "us.wa_c26mvd")
  expect_equal(wenatcheeNewName, "Wenatchee-Fifth St")
})

Try the MazamaLocationUtils package in your browser

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

MazamaLocationUtils documentation built on Nov. 2, 2023, 6:16 p.m.