Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mjfrigaard/mstsap

Mastering Shiny testServer() application package (demo)
https://github.com/mjfrigaard/mstsap

Last synced: 9 days ago
JSON representation

Mastering Shiny testServer() application package (demo)

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# `mstsap`

`mstsap` (Mastering shiny `testServer()` app-package) is a collection of tests using [`testthat`](https://testthat.r-lib.org/) and [`shiny::testServer()`](https://search.r-project.org/CRAN/refmans/shiny/html/testServer.html).

The modules and applications in `mstsap` come from the [Shiny modules chapter](https://mastering-shiny.org/scaling-modules.html) of [Mastering Shiny](https://mastering-shiny.org/index.html).

## Installation

You don't *have* to install the `mstsap` package, but you might want to download it as an example (or read through [this post](https://mjfrigaard.github.io/posts/test-shiny-p3/) to learn about it's contents).

```{r}
#| eval: false
install.packages("remotes")
remotes::install_github("mjfrigaard/mstsap")
library(mstsap)
```

## Utility function tests

There is a single utility function in `mstsap`: `find_vars()`

```{r}
#| eval: true
#| echo: false
fs::dir_tree("tests/testthat/", regexp = "find")
```

```{r}
#| eval: false
testthat::test_file("tests/testthat/test-find_vars.R")
```

```{verbatim}
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 4 ]
```

## `testServer()` tests

```{r}
#| eval: true
#| echo: false
fs::dir_tree("tests/testthat/", regexp = "Server|App")
```

```{verbatim}
🐝 Your tests are the bee's knees 🐝
```