tests/testthat/test-TableWare-R6.R

context("unit test for TableWare Object")

test_that("Instantiating a TableWare on mtcars appends it DQA operations", {
    # Invalid input arguments
    expect_error(TableWare$new())
    expect_error(TableWare$new(mtcars, data.frame()))

    # Valid input argument
    expect_silent(mtcars_profile <- TableProfiler$new(mtcars)$profile)
    expect_class(TW <- TableWare$new(mtcars, mtcars_profile), "TableWare")
    expect_class(TW$table, "data.frame")
})

test_that("TableWare methods run", {
    expect_silent(mtcars_profile <- TableProfiler$new(mtcars)$profile)

    expect_class(
        TableWare$new(mtcars, mtcars_profile)$convert_col_types(),
        "data.frame"
    )
})
tidylab/tableware documentation built on July 6, 2019, 1:12 a.m.