tests/testthat/test-assertions.R

context("Check assertion-related functions")

thischeck=function() {
    test_that("NULL returned when no assertions present in input", {
        temp=data.frame()
        class(temp)=c("occurrences",class(temp))
        expect_null(check_assertions(temp))
    })
}
check_caching(thischeck)


thischeck=function() {
    test_that("check_assertions checks class of input correctly", {
        temp=data.frame()
        expect_error(check_assertions(temp))    
        class(temp)=c("occurrences",class(temp))
        expect_null(check_assertions(temp))
    })
}
check_caching(thischeck)

# thischeck=function() {
#     test_that("check_assertions gets all assertions in occurrences object", {
#         skip_on_cran()
#         x=occurrences(taxon="Otis tarda", 
#                       download_reason_id=10,
#                       qa=sbdi_fields("assertions",as_is=TRUE)$name,
#                       email = "test@test.com")    
#         expect_equal(length(setdiff(check_assertions(x)$name, sbdi_fields("assertions",as_is=TRUE)$name)),0) ## expect all assertion fields in object to be in the list of master assertion fields 
#         x=occurrences(taxon="Otis tarda", 
#                       download_reason_id=10,
#                       qa="none", email = "test@test.com")
#         expect_null(check_assertions(x)$name)
#     })
# }
# check_caching(thischeck)
bioatlas/r-functionality documentation built on Nov. 1, 2020, 3:42 a.m.