Skip to content

Commit

Permalink
adding unit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeyakirar committed Oct 5, 2023
1 parent 6f21a89 commit e26313c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
testthat::test_that("card_template function returns TealReportCard object with appropriate content and labels", {

fd <- teal.slice::init_filtered_data(list(iris = list(dataset = iris)))
filter_panel_api <- teal.slice::FilterPanelAPI$new(fd)

card <- shiny::isolate(card_template("Card title", "Card label", TRUE, filter_panel_api))
testthat::expect_s3_class(card, c("TealReportCard"))
testthat::expect_equal(card$get_name(), "Card label")
testthat::expect_length(card$get_content(), 3)

card <- shiny::isolate(card_template("Card title", "", FALSE, filter_panel_api))
testthat::expect_s3_class(card, c("TealReportCard"))
testthat::expect_equal(card$get_name(), "Card title")
testthat::expect_length(card$get_content(), 1)
})

0 comments on commit e26313c

Please sign in to comment.