Test virtualSelectInput with shinytest2 #742
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a couple simple tests to make sure virtualSelectInput initializes and passes its values to Shiny. It catches the issues that was introduced in shiny v1.11.0 (and will be fixed in shiny v1.11.1).
I pinned shiny to v1.10.0 in the DESCRIPTION until they push 1.11.1. Parts of this test fail with 1.11.0 (which is most of the point of this test!).
Note: It generates pngs as part of the tests, but it doesn't actually check those images. I generally recommend looking at them visually (if they change when you run tests locally) to make sure you don't see anything weird (via
testthat::snapshot_review(), and then accept them if they look fine), but the json side is the real test.This is a first example. Most of this package likely could/should be tested this way, but I recommend working out
virtualSelectInput()completely before implementing tests for other inputs.