Skip to content

Commit

Permalink
Revert "try removing snapshot tests"
Browse files Browse the repository at this point in the history
This reverts commit b3eaf8c.
  • Loading branch information
k-doering-NOAA committed Dec 18, 2024
1 parent f3d7fb7 commit 13634df
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/_snaps/add_chunk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# add_chunk() generates correct R Markdown chunk

Code
cat(add_chunk("plot(cars$speed, cars$distance)"))
Output
```{r}
#| echo: false
#| warning: false
#| eval: true
plot(cars$speed, cars$distance)
```

---

Code
cat(add_chunk("plot(cars$speed, cars$distance)", echo = "true"))
Output
```{r}
#| echo: true
#| warning: false
#| eval: true
plot(cars$speed, cars$distance)
```

9 changes: 9 additions & 0 deletions tests/testthat/test-add_chunk.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test_that("add_chunk() generates correct R Markdown chunk", {
# The test checks if the add_chunk() function correctly generates an R Markdown chunk.

# Use expect_snapshot() to capture and compare the output of the add_chunk() function.
# This ensures that any changes in the function's output will be detected in future test runs.
expect_snapshot(cat(add_chunk("plot(cars$speed, cars$distance)")))

expect_snapshot(cat(add_chunk("plot(cars$speed, cars$distance)", echo = "true")))
})

0 comments on commit 13634df

Please sign in to comment.