Skip to content

Commit

Permalink
add test for locked environment
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Oct 23, 2023
1 parent 8f3b812 commit bb6e0ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/testthat/test-teal_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ testthat::test_that("teal_data code is concatenated into single string", {
)
})

testthat::test_that("teal_data@env is locked. Not able to modify, add or remove bindings", {
data <- teal_data(iris = iris)
testthat::expect_error(data@env$iris <- iris, "cannot change value of locked binding for 'iris'")
testthat::expect_error(data@env$iris2 <- iris, "cannot add bindings to a locked environment")
testthat::expect_error(rm("iris", envir = data@env), "cannot remove bindings from a locked environment")
})

testthat::test_that("teal_data sets passed join_keys to datasets correctly", {
df1 <- data.frame(id = c("A", "B"), a = c(1L, 2L))
Expand Down

0 comments on commit bb6e0ff

Please sign in to comment.