-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update init_cookies to have the JS code inline and add some tests
- Loading branch information
Showing
5 changed files
with
91 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
test_that("Rejects non-boolean for create_file", { | ||
expect_error(init_cookies(create_file = "Funky non-boolean")) | ||
}) | ||
|
||
test_that("Javascript writes out", { | ||
output <- capture.output(init_cookies(create_file = FALSE)) | ||
|
||
# Expect to find a couple of other key parts | ||
expect_equal(output[1], "function getCookies(){") | ||
expect_true(grepl("Shiny\\.setInputValue\\('cookies'", output[3])) | ||
expect_true(grepl("cookie-set", output[6])) | ||
expect_true(grepl("cookie-clear", output[11])) | ||
expect_true(grepl("analytics-consent", output[20])) | ||
}) |