inst/apps/050-kmeans-example/tests/testthat/test-server.R

testServer(expr = {
  test_that("it works", {
    session$setInputs(
      xcol = "Sepal.Length",
      ycol = "Petal.Length",
      clusters = 4
    )
    expect_equal(colnames(selectedData()), c("Sepal.Length", "Petal.Length"))
    expect_equal(nrow(clusters()$centers), 4)
    session$setInputs(clusters = 3)
    expect_equal(nrow(clusters()$centers), 3)
  })
})
rstudio/shinycoreci documentation built on April 11, 2025, 3:17 p.m.