tests/testthat/test-golem_utils_server.R

test_that("not_in works", {
    expect_true(1 %not_in% 2:10)
    expect_false(1 %not_in% 1:10)
})

test_that("not_null works", {
    expect_true(not_null(1))
    expect_false(not_null(NULL))
})

test_that("not_na works", {
    expect_true(not_na(1))
    expect_false(not_na(NA))
})

test_that("drop_nulls works", {
    expect_equal(
        drop_nulls(
            list(x = NULL, y = 2)
        ),
        list(y = 2)
    )
})

test_that("%||% works", {
    expect_equal(
        NULL %||% 1,
        1
    )
    expect_equal(
        2 %||% 1,
        2
    )
})

test_that("%NA% works", {
    expect_equal(
        NA %NA% 1,
        1
    )
    expect_equal(
        2 %NA% 1,
        2
    )
})

test_that("rv and rvtl work", {
    x <- rv(x = 12)
    expect_s3_class(
        x,
        "reactivevalues"
    )
    x <- rvtl(rv(x = 12))
    expect_true(
        inherits(
            x,
            "list"
        )
    )
})
ReseauBiodiversiteQuebec/tableaudelta documentation built on May 25, 2022, 5:26 p.m.