Skip to content

Commit

Permalink
increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 4, 2024
1 parent 7a1f372 commit 4301434
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/_snaps/data_peek.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,22 @@
Petal.Width | numeric | 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.2, 0.1, 0.1, 0.2, 0.4, 0.4, 0.3, 0.3, 0.3, ...
Species | factor | setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, setosa, ...

# data_peek, print_md works as expected

Code
print_md(out)
Output
[1] "Table: Data frame with 150 rows and 5 variables"
[2] ""
[3] "|Variable | Type | Values |"
[4] "|:------------|:-------|:----------------------------------------------|"
[5] "|Sepal.Length |numeric | 5.1, 4.9, 4.7, 4.6, 5, 5.4, 4.6, 5, 4.4, ... |"
[6] "|Sepal.Width |numeric |3.5, 3, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, ... |"
[7] "|Petal.Length |numeric | 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, ... |"
[8] "|Petal.Width |numeric | 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, ... |"
[9] "|Species | factor | setosa, setosa, setosa, setosa, setosa, ... |"
attr(,"format")
[1] "pipe"
attr(,"class")
[1] "knitr_kable" "character"

6 changes: 6 additions & 0 deletions tests/testthat/test-data_peek.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ test_that("data_peek snapshots look as expected", {
expect_snapshot(data_peek(iris, select = 1:3))
expect_snapshot(data_peek(iris, width = 130))
})


test_that("data_peek, print_md works as expected", {
out <- data_peek(iris)
expect_snapshot(print_md(out))
})

0 comments on commit 4301434

Please sign in to comment.