Skip to content

Commit aff9b99

Browse files
committed
Update testthat and remove deprecated context calls
1 parent d419517 commit aff9b99

11 files changed

+13
-33
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Imports:
2525
rlang,
2626
utils
2727
Suggests:
28-
testthat,
28+
testthat (>= 3.1.0),
2929
rstudioapi
3030
License: MIT + file LICENSE
3131
Encoding: UTF-8

tests/testthat/test-attributes.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("attributes")
2-
31
test_that("stylesheets can be added with or without attributes", {
42
stylesheet_pattern <- '^.*<link href="(https.*)">.*$'
53
script_pattern <- '^.*<script src="(https.*)">.*$'

tests/testthat/test-callback.R

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("callback")
2-
31
test_that("Callback outputs can be provided with or without output function", {
42

53
app <- Dash$new()
@@ -14,7 +12,7 @@ test_that("Callback outputs can be provided with or without output function", {
1412
)
1513
)
1614
)
17-
15+
1816
expect_silent(
1917
app$callback(output(id = 'output-state', property = 'children'),
2018
list(input(id = 'submit-button', property = 'n_clicks'),
@@ -24,7 +22,7 @@ test_that("Callback outputs can be provided with or without output function", {
2422
sprintf("The Button has been pressed \"%s\" times, Input 1 is \"%s\", and Input 2 is \"%s\"", n_clicks, input1, input2)
2523
})
2624
)
27-
25+
2826
expect_silent(
2927
app$callback(output=list(id = 'output-state', property = 'children'),
3028
list(input(id = 'submit-button', property = 'n_clicks'),
@@ -37,9 +35,9 @@ test_that("Callback outputs can be provided with or without output function", {
3735
})
3836

3937
test_that("Repeating outputs across callbacks yields an error", {
40-
38+
4139
app <- Dash$new()
42-
40+
4341
app$layout(
4442
htmlDiv(
4543
list(
@@ -54,7 +52,7 @@ test_that("Repeating outputs across callbacks yields an error", {
5452
)
5553
)
5654
)
57-
55+
5856
app$callback(list(output(id = 'output-state', property = 'children'),
5957
output(id = 'output-two', property = 'children')),
6058
list(input(id = 'submit-button', property = 'n_clicks'),
@@ -63,7 +61,7 @@ test_that("Repeating outputs across callbacks yields an error", {
6361
function(n_clicks, input1, input2) {
6462
sprintf("The Button has been pressed \"%s\" times, Input 1 is \"%s\", and Input 2 is \"%s\"", n_clicks, input1, input2)
6563
})
66-
64+
6765
expect_error(
6866
app$callback(list(output(id = 'output-state', property = 'children'),
6967
output(id = 'output-three', property = 'children')),

tests/testthat/test-components.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("components")
2-
31
test_that("Components work recursively (components can be children of components)", {
42

53
# div inside a div
@@ -75,7 +73,7 @@ test_that("wildcard attributes work with children", {
7573

7674
# test_that("Can translate arbitrary HTML string", {
7775
# skip_if_not_installed("dashDangerouslySetInnerHtml")
78-
#
76+
#
7977
# html <- "<div> 1 </div>"
8078
# expect_is(
8179
# dashDangerouslySetInnerHtml::DangerouslySetInnerHTML(HTML(html)),

tests/testthat/test-dash.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("dash-api")
2-
31
test_that("Can access fiery server within a dash app", {
42

53
d <- Dash$new()

tests/testthat/test-index.R

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("customindex")
2-
31
test_that("Omitting required template keys produces warnings", {
42
string <-
53
"<!DOCTYPE html>
@@ -18,24 +16,24 @@ test_that("Omitting required template keys produces warnings", {
1816
</footer>
1917
</body>
2018
</html>"
21-
19+
2220
app <- Dash$new()
23-
21+
2422
expect_error(
2523
app$index_string(gsub("\\{\\%config\\%\\}|\\{\\%scripts\\%\\}|\\{\\%app_entry\\%\\}", "", string)),
2624
"Did you forget to include app_entry, config, scripts in your index string?"
2725
)
28-
26+
2927
expect_error(
3028
app$index_string(gsub("\\{\\%scripts\\%\\}", "", string)),
3129
"Did you forget to include scripts in your index string?"
3230
)
33-
31+
3432
expect_error(
3533
app$index_string(gsub("\\{\\%app_entry\\%\\}", "", string)),
3634
"Did you forget to include app_entry in your index string?"
3735
)
38-
36+
3937
expect_error(
4038
app$index_string(gsub("\\{\\%config\\%\\}", "", string)),
4139
"Did you forget to include config in your index string?"

tests/testthat/test-layout.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("layout")
2-
31
test_that("layout IDs must be unique", {
42

53
app <- Dash$new()

tests/testthat/test-routes.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("routes")
2-
31
test_that("URLs are properly redirected with app$redirect", {
42
app <- Dash$new()
53

tests/testthat/test-tags.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("tags")
2-
31
test_that("Tag basics", {
42
expect_identical(div("a", "b"), htmlDiv(list("a", "b")))
53
expect_identical(div("a", "b", 5), htmlDiv(list("a", "b", 5)))

tests/testthat/test-utils.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("utils")
2-
31
test_that("remove_empty", {
42
expect_error(remove_empty())
53
expect_null(remove_empty(NULL))

tests/testthat/test-wildcards.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
context("wildcards")
2-
31
test_that("HTML `data-*` & `aria-* ` wildcards work", {
42
x <- htmlDiv(`data-foo` = 1)
53
expect_equal(x$props$`data-foo`, 1)

0 commit comments

Comments
 (0)