Commit 8bc31af5 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Add tests

parent 03f3b7af
......@@ -104,6 +104,8 @@ readNWISpCode <- function(parameterCd){
parameterData <- rbind(parameterData, na.params)
}
# order by parameterCd.orig
parameterData <- parameterData[match(parameterCd.orig, parameterData$parameter_cd),]
if(!isTRUE(parameterCd.orig == "all")){
parameterData <- parameterData[match(parameterCd.orig, parameterData$parameter_cd),]
}
return(parameterData)
}
......@@ -394,10 +394,12 @@ test_that("pCode Stuff", {
testthat::skip_on_cran()
paramINFO <- readNWISpCode(c('01075','00060','00931', NA))
paramINFO <- readNWISpCode(c('00060','01075','00931', NA))
expect_equal(nrow(paramINFO), 4)
expect_equal(paramINFO$parameter_cd, c('00060','01075','00931', NA) )
paramINFO <- readNWISpCode("all")
expect_true(nrow(paramINFO) > 24000)
expect_equal(attr(paramINFO, "url"),
"https://help.waterdata.usgs.gov/code/parameter_cd_query?fmt=rdb&group_cd=%")
})
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment