Skip to content

Commit

Permalink
Use deployment data that only occurs at midnight UTC. Closes #44.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhpob committed Nov 26, 2024
1 parent b512901 commit 078e18b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: otndo
Title: Understand your OTN data
Version: 0.3.0
Version: 0.3.1
Authors@R:
person("Michael", "O'Brien", , "mike@obrien.page", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1420-6395"))
Expand Down
2 changes: 1 addition & 1 deletion R/utilities_make.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ write_to_tempdir <- function(type, files, temp_dir) {

## Write file to temporary directory
filepath <- file.path(temp_dir, paste0(type, ".csv"))
write.csv(files, filepath,
data.table::fwrite(files, filepath,
row.names = F
)

Expand Down
40 changes: 39 additions & 1 deletion tests/testthat/test-write_to_tempdir.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
test_that("writes and converts deployment data", {
skip("Test TBD")
deployment_filepath <- write_to_tempdir(
type = "deployment",
files = pbsm$deployment,
temp_dir = td
)

expect_true(file.exists(deployment_filepath))


deployment <- data.table::fread(deployment_filepath)

expect_named(
deployment,
c(
"stationname", "receiver", "internal_transmitter", "deploy_date_time",
"deploy_lat", "deploy_long", "recover_date_time"
)
)

expect_s3_class(
deployment$deploy_date_time,
"POSIXct"
)
expect_s3_class(
deployment$recover_date_time,
"POSIXct"
)

expect_type(
deployment$deploy_lat,
"double"
)

expect_type(
deployment$deploy_lon,
"double"
)

})


test_that("works with multiple deployment files", {
skip("Test TBD")
})
Expand Down

0 comments on commit 078e18b

Please sign in to comment.