tests/testthat/test-tabTableOne.R

test_that("tabTableOne returns the correct object", {
  # create a dummy datatable
  dummy_data <- data.frame(
    A = 1:5,
    B = letters[1:5]
  )

  dummy_dt <- DT::datatable(dummy_data)

  # Run the function
  test_obj <- tabTableOne("dummy_id", dummy_dt)

  # Check the class of the output
  expect_s3_class(test_obj, "shiny.tag")

  # Check the name of the tag
  expect_equal(test_obj$name, "div")

  # Check the list of class attributes
  expect_true("tab-pane" %in% test_obj$attribs$class)
})

Try the vvshiny package in your browser

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

vvshiny documentation built on July 26, 2023, 5:50 p.m.