tests/testthat/test-drop_rows_with_na.R

context("unit test for drop_rows_with_na")

test_that("drop_rows_with_na fails when given invalid input arguments", {
    # No input arguments
    expect_error(drop_rows_with_na())
})

test_that("drop_rows_with_na remove na as specified in the table profile", {
    mtcars_profile <- generate_table_profile(.data = mtcars)
    expect_identical(drop_rows_with_na(mtcars, mtcars_profile), mtcars)

    set.seed(2048)
    mtcars_with_na <- .insert_na_at_random(mtcars)
    expect_identical(
        drop_rows_with_na(mtcars_with_na, mtcars_profile),
        mtcars_with_na[complete.cases(mtcars_with_na),]
    )
})
tidylab/tidylab.dqa documentation built on June 21, 2019, 7 p.m.