Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ldecicco-USGS committed Oct 22, 2024
1 parent e1f8a1e commit aea05dd
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 58 deletions.
5 changes: 2 additions & 3 deletions R/readWQPqw.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@
#' \donttest{
#' rawPcode <- readWQPqw("USGS-01594440", "01075", "", "")
#'
#' attr(rawPcode, "url")
#' attr(rawPcode, "siteInfo")
#' attr(rawPcode, "queryTime")
#' attr(rawPcode, "headerInfo")[["dataProviders"]]
#'
#'
#' rawCharacteristicName <- readWQPqw("WIDNR_WQX-10032762", "Specific conductance", "", "")
#' rawPHsites <- readWQPqw(c("USGS-05406450", "USGS-05427949", "WIDNR_WQX-133040"), "pH", "", "")
Expand All @@ -69,7 +68,7 @@ readWQPqw <- function(siteNumbers,
startDate = "",
endDate = "",
tz = "UTC",
legacy = FALSE,
legacy = TRUE,
querySummary = FALSE,
ignore_attributes = FALSE,
convertType = TRUE) {
Expand Down
5 changes: 2 additions & 3 deletions man/readWQPqw.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

127 changes: 82 additions & 45 deletions pkgdown/templates/header.html
Original file line number Diff line number Diff line change
@@ -1,45 +1,82 @@
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<link href="extra.css" rel="stylesheet" type="text/css" media="screen" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->


<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-TKQR8KP');</script>
<!-- End Google Tag Manager -->

</head>

<body> <!-- opening div for body -->
<!-- BEGIN USGS Applications Header Template -->
<header id="navbar" class="header-nav" role="banner">
<div class="tmp-container">
<!-- primary navigation bar -->
<!-- search bar-->
<<div class="header-search">
<!-- <a class="logo-header" href="https://www.usgs.gov/" title="Home">
<img class="img" src="logo.png" alt="Home" />
</a>-->
<!-- <form action="https://www.usgs.gov/science-explorer-results" method="GET" id="search-box">
<div class="fa-wrapper"><label for="se_search" class="only">Search</label>
<input id="se_search" type="search" name="es" placeholder="Search">
<button class="fa fa-search" type="submit">
<span class="only">Search</span>
</button></div>
</form> -->
</div>
<!-- end search bar-->
</div>
<!-- end header-container-->
</header>
<!-- END USGS Applications Header Template -->
<div id="maincontent"> <!-- opening div for your main content -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>{{{pagetitle}}} • {{#site}}{{title}}{{/site}}</title>

{{#has_favicons}}
<!-- favicons -->
<link rel="icon" type="image/png" sizes="16x16" href="{{#site}}{{root}}{{/site}}favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{#site}}{{root}}{{/site}}favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="{{#site}}{{root}}{{/site}}apple-touch-icon.png" />
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="{{#site}}{{root}}{{/site}}apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="{{#site}}{{root}}{{/site}}apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="{{#site}}{{root}}{{/site}}apple-touch-icon-60x60.png" />
{{/has_favicons}}

<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>

<!-- Bootstrap -->

<link href="{{#site}}{{root}}{{/site}}extra.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script>

<!-- bootstrap-toc -->
<link rel="stylesheet" href="{{#site}}{{root}}{{/site}}bootstrap-toc.css">
<script src="{{#site}}{{root}}{{/site}}bootstrap-toc.js"></script>

<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous" />

<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>

<!-- headroom.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script>

<!-- pkgdown -->
<link href="{{#site}}{{root}}{{/site}}pkgdown.css" rel="stylesheet">
<script src="{{#site}}{{root}}{{/site}}pkgdown.js"></script>
<link href="{{#site}}{{root}}{{/site}}tidyverse-2.css" rel="stylesheet">

<!--optional theme-->
<link href="{{#site}}{{root}}{{/site}}{{#yaml}}{{theme}}.css{{/yaml}}" rel="stylesheet">


{{#yaml}}{{#docsearch}}
<!-- docsearch -->
<script src="{{#site}}{{root}}{{/site}}docsearch.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsearch.js/2.6.1/docsearch.min.css" integrity="sha256-QOSRU/ra9ActyXkIBbiIB144aDBdtvXBcNc3OTNuX/Q=" crossorigin="anonymous" />
<link href="{{#site}}{{root}}{{/site}}docsearch.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha256-4HLtjeVgH0eIB3aZ9mLYF6E8oU5chNdjU6p6rrXpl9U=" crossorigin="anonymous"></script>
{{/docsearch}}{{/yaml}}

<meta property="og:title" content="{{{pagetitle}}}" />
{{#opengraph}}
{{#description}}
<meta property="og:description" content="{{.}}" />
{{/description}}
{{#image}}
<meta property="og:image" content="{{{.}}}" />
{{/image}}
<meta name="twitter:card" content="summary" />
{{/opengraph}}

{{#yaml}}{{#noindex}}<meta name="robots" content="noindex" />{{/noindex}}{{/yaml}}
{{#development}}{{#in_dev}}<meta name="robots" content="noindex">{{/in_dev}}{{/development}}

<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>

<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<link href="deps/bootstrap-5.1.0/bootstrap.min.css" rel="stylesheet">
<script src="deps/bootstrap-5.1.0/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
8 changes: 4 additions & 4 deletions tests/testthat/tests_imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,15 @@ context("importWQP_noCRAN")
test_that("External WQP tests", {
testthat::skip_on_cran()

rawSampleURL <- constructWQPURL("USGS-01594440", "01075", "", "")
rawSampleURL <- constructWQPURL("USGS-01594440", "01075", "", "", legacy = FALSE)
rawSample <- importWQP(rawSampleURL)
expect_is(rawSample$Activity_StartDateTime, "POSIXct")

url2 <- constructWQPURL("USGS-01594440", "01075", "", "")
url2 <- constructWQPURL("USGS-01594440", "01075", "", "", legacy = TRUE)
rawSample2 <- suppressWarnings(importWQP(url2))
expect_is(rawSample2$Activity_StartDateTime, "POSIXct")
expect_is(rawSample2$ActivityStartDateTime, "POSIXct")

STORETex <- constructWQPURL("WIDNR_WQX-10032762", "Specific conductance", "", "")
STORETex <- constructWQPURL("WIDNR_WQX-10032762", "Specific conductance", "", "", legacy = FALSE)
STORETdata <- importWQP(STORETex)
expect_is(STORETdata$Activity_StartDateTime, "POSIXct")
})
8 changes: 5 additions & 3 deletions tests/testthat/tests_userFriendly_fxns.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,15 @@ test_that("WQP qw tests", {
nameToUse <- "Specific conductance"
pcodeToUse <- "00095"

INFO_WQP <- readWQPqw("USGS-04024315", pcodeToUse, startDate = "", endDate = "")
INFO_WQP <- readWQPqw("USGS-04024315", pcodeToUse,
startDate = "", endDate = "", legacy = FALSE)
expect_is(INFO_WQP$Activity_StartDateTime, "POSIXct")

INFO2 <- readWQPqw("WIDNR_WQX-10032762", nameToUse, startDate = "", endDate = "")
INFO2 <- readWQPqw("WIDNR_WQX-10032762", nameToUse,
startDate = "", endDate = "", legacy = FALSE)
expect_is(INFO2$Activity_StartDateTime, "POSIXct")

df <- readWQPqw("USGS-04193500", parameterCd = "00665")
df <- readWQPqw("USGS-04193500", parameterCd = "00665", legacy = FALSE)
expect_true(nrow(df) > 0)

df2 <- readWQPqw("USGS-05427718", parameterCd = "all")
Expand Down

0 comments on commit aea05dd

Please sign in to comment.