tests/testthat/test-explore-complement_contrasts.R

test_that("explore.complement_contrasts()", {
    .skip_if_shiny_not_installed()

    d <- partition(mtcars, .breaks = 2, .keep = TRUE)
    res <- suppressWarnings({
        dig_complement_contrasts(d,
                                 condition = where(is.logical),
                                 vars = where(is.numeric),
                                 min_support = 0.3,
                                 max_length = 2)
    })

    # test run on some results
    expect_true(is_nugget(res))
    expect_true(nrow(res) > 0)

    app <- explore(res)
    expect_true(inherits(app, "shiny.appobj"))

    app <- explore(res, data = d)
    expect_true(inherits(app, "shiny.appobj"))

    # test run on empty results
    empty <- res[0, ]
    app <- explore(empty)
    expect_true(inherits(app, "shiny.appobj"))

    app <- explore(empty, data = d)
    expect_true(inherits(app, "shiny.appobj"))
})

Try the nuggets package in your browser

Any scripts or data that you put into this service are public.

nuggets documentation built on March 11, 2026, 5:06 p.m.