Skip to content

Commit

Permalink
temperature summaries test
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyclements committed Oct 25, 2023
1 parent 6356e54 commit 1f8a2a6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
Binary file added tests/test_1_annual.rds
Binary file not shown.
Binary file added tests/test_1_monthly.rds
Binary file not shown.
43 changes: 16 additions & 27 deletions tests/testthat/test-total_temperature_summaries.R
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
# library(testthat)
#
# # Test case 1: Test with to = "annual"
# result <- epicsawrap:::total_temperature_summaries(
# country = "zm",
# station_id = "23",
# summaries = c("mean_tmin", "mean_tmax"),
# to = "annual"
# )
#
# # Test case 2: Test with to = "monthly"
# result_2 <- epicsawrap:::total_temperature_summaries(
# country = "zm",
# station_id = "1",
# summaries = c("mean_tmin", "mean_tmax"),
# to = "monthly"
# )
#
# # Define test cases
# test_that("total_temperature_summaries returns correct results", {
# # Mock the necessary external functions or datasets if needed
# expect_length(result, 2)
# expect_length(result_2, 2)
#
# expect_no_error(result)
# expect_no_error(result_2)
# })
library(testthat)
library(rpicsa)

# Test case 1
epicsawrap::gcs_auth_file(file = "tests/e-picsa-e630400792e7.json")
test_1_annual <- readRDS("tests/test_1_annual.rds")
test_1_monthly <- readRDS("tests/test_1_monthly.rds")
country <- "zm"
station_id <- "test_1"
result_annual <- epicsawrap::annual_temperature_summaries(country, station_id)
result_monthly <- epicsawrap::monthly_temperature_summaries(country, station_id)

test_that("Correct summaries are calculated", {
expect_true(identical(result_annual[[2]], test_1_annual))
expect_true(identical(result_monthly[[2]], test_1_monthly))
})

0 comments on commit 1f8a2a6

Please sign in to comment.