tests/testthat/test_eq_clean.R

context("eq_clean")

test_that("eq_clean_data builds date variable correctly",{
  df <- data.frame(YEAR = 2018, MONTH = 8, DAY = 1:31, LATITUDE = NA, LONGITUDE = NA)

  expect_identical(
    range(eq_clean_data(df)$DATE),
          as.Date(c("2018-08-01", "2018-08-31"), format = "%Y-%m-%d")
    )
})

test_that("eq_location_clean works",{
  expect_identical(
    head(eq_location_clean(data.frame(LOCATION_NAME = "Country: Text Label "))$LOCATION_NAME),
    "Text Label"
  )
})
avidclam/msdr5 documentation built on May 29, 2019, 11:02 p.m.