test_that("prep_table function works correctly", { ## Generate some mock data for testing df <- data.frame(VIS_Groep = c("Group1", "Group1", "Group2", "Group2"), VIS_Groep_naam = c("Name1", "Name1", "Name2", "Name2"), y = c(TRUE, TRUE, FALSE, FALSE), z = c(TRUE, FALSE, TRUE, FALSE)) df_summarized <- df %>% dplyr::group_by(VIS_Groep, VIS_Groep_naam) %>% dplyr::summarise( y = mean(y), z = mean(z) ) %>% dplyr::ungroup() id = "id" ## Test with y_right NULL output <- prep_table("y", df, df_summarized, id) # Check output type expect_s3_class(output, "datatables") expect_s3_class(output, "htmlwidget") # Check lay-out expect_equal(output$x$options$buttons, list("excel", "pdf", "print")) expect_equal(output$x$caption, "