tests/testthat/test_eq_location_clean.R

context('Location Clean Function')

# load data from package
df <- NOAAearthquakes
df_clean <- eq_location_clean(df)

test_that('Is eq_location_clean(data) function working properly ?', {


        expect_is(df_clean$LOCATION_NAME, 'character')

        expect_equal(df_clean$LOCATION_NAME,
                     df_clean$LOCATION_NAME %>%  # transform first to lower then title
                             stringr::str_to_lower() %>%
                             stringr::str_to_title())
})
Brunobt80/rPkgNOAADataset documentation built on May 20, 2019, 12:57 a.m.