Skip to content

Commit fb1ad3c

Browse files
authored
refactor(test): format and cut tests (#209)
1 parent f84afca commit fb1ad3c

File tree

2 files changed

+197
-427
lines changed

2 files changed

+197
-427
lines changed
Lines changed: 17 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,40 @@
11
test_that("display works", {
22
res <- display(
3-
system.file(
4-
"examples/Email_Voting.bpmn",
5-
package = "bpmnVisualizationR"
6-
)
7-
)
8-
expect_true(
9-
inherits(
10-
res,
11-
"bpmnVisualizationR"
12-
)
3+
system.file("examples/Email_Voting.bpmn", package = "bpmnVisualizationR")
134
)
14-
expect_true(
15-
inherits(
16-
res,
17-
"htmlwidget"
18-
)
19-
)
20-
5+
6+
expect_true(inherits(res, "bpmnVisualizationR"))
7+
expect_true(inherits(res, "htmlwidget"))
8+
219
# Be sure that the xml is in the widget
2210
string <- paste(
2311
readLines(
24-
system.file(
25-
"examples/Email_Voting.bpmn",
26-
package = "bpmnVisualizationR"
27-
)
12+
system.file("examples/Email_Voting.bpmn", package = "bpmnVisualizationR")
2813
),
2914
collapse = " "
3015
)
31-
32-
expect_true(
33-
grepl(
34-
substr(string, 1000, 1010),
35-
res$x$bpmnContent
36-
)
37-
)
38-
39-
expect_true(
40-
grepl(
41-
substr(string, 2000, 2010),
42-
res$x$bpmnContent
43-
)
44-
)
16+
17+
expect_true(grepl(substr(string, 1000, 1010), res$x$bpmnContent))
18+
expect_true(grepl(substr(string, 2000, 2010), res$x$bpmnContent))
4519
})
4620

4721
test_that("bpmnVisualizationROutput works", {
4822
res <- bpmnVisualizationROutput("xyz")
49-
expect_true(
50-
inherits(
51-
res,
52-
"shiny.tag.list"
53-
)
54-
)
55-
56-
expect_true(
57-
grepl(
58-
"bpmnVisualizationR",
59-
res
60-
)
61-
)
23+
24+
expect_true(inherits(res, "shiny.tag.list"))
25+
expect_true(grepl("bpmnVisualizationR", res))
6226
})
6327

6428

6529
test_that("renderBpmnVisualizationR works", {
6630
skip_if_not_installed("shiny")
31+
6732
res <- renderBpmnVisualizationR({
6833
display(
69-
system.file(
70-
"examples/Email_Voting.bpmn",
71-
package = "bpmnVisualizationR"
72-
)
34+
system.file("examples/Email_Voting.bpmn", package = "bpmnVisualizationR")
7335
)
7436
})
75-
expect_true(
76-
inherits(
77-
res,
78-
"shiny.render.function"
79-
)
80-
)
81-
expect_true(
82-
inherits(
83-
res(),
84-
"json"
85-
)
86-
)
37+
38+
expect_true(inherits(res, "shiny.render.function"))
39+
expect_true(inherits(res(), "json"))
8740
})

0 commit comments

Comments
 (0)