Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurData committed Jul 8, 2022
1 parent 478f781 commit ac3bbcb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dev/flat_minimal.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ if (interactive()) {
```

```{r tests-sendConfetti}
library(shinytest2)
test_that("sendConfetti works", {
library(shinytest2)
expect_true(inherits(sendConfetti, "function"))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-sendconfetti.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

test_that("sendConfetti works", {
library(shinytest2)

expect_true(inherits(sendConfetti, "function"))

app <- shinytest2::AppDriver$new(
Expand Down
25 changes: 0 additions & 25 deletions tests/testthat/test-useconfetti.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,3 @@ test_that("useConfetti works", {
expect_equal(dep[["name"]], "canvas-confetti")
expect_true(length(dep[["script"]]) > 1)
})

test_that("sendConfetti works", {
library(shinytest2)

expect_true(inherits(sendConfetti, "function"))

app <- shinytest2::AppDriver$new(
system.file("shiny", "test", "app.R", package = "confetti")
)
expect_equal(app$get_value(input = "go")[[1]], 0)
expect_equal(app$get_value(input = "sentConfetti")[[1]], 0)

app$click("go")
html <- app$get_html("canvas")
expect_equal(
html,
"<canvas style=\"position: fixed; top: 0px; left: 0px; pointer-events: none; z-index: 100;\" width=\"992\" height=\"1323\"></canvas>"
)
expect_equal(app$get_value(input = "go")[[1]], 1)
expect_equal(app$get_value(input = "sentConfetti")[[1]], 1)

app$click("go")
expect_equal(app$get_value(input = "go")[[1]], 2)
expect_equal(app$get_value(input = "sentConfetti")[[1]], 2)
})

0 comments on commit ac3bbcb

Please sign in to comment.