Skip to content

Commit

Permalink
Use force_identical_write to update metadata in test (#765)
Browse files Browse the repository at this point in the history
* Use `force_identical_write` to update metadata in test

* Mock version name, for timestamp issue
  • Loading branch information
juliasilge authored Aug 11, 2023
1 parent ff30f59 commit 5537ce4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/pin-meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ test_api_meta <- function(board) {
})

testthat::test_that("can update pin metadata", {
mock_version_name <-
mockery::mock(
"20130104T050607Z-xxxxx",
"20130204T050607Z-yyyyy"
)
testthat::local_mocked_bindings(version_name = mock_version_name)
# RSC requires at least 3 characters
name <- local_pin(board, 1, title = "xxx-a1", description = "xxx-a2")
# change content so hash changes
pin_write(board, 2, name, title = "xxx-b1", description = "xxx-b2")
pin_write(board, 1, name, title = "xxx-b1", description = "xxx-b2", force_identical_write = TRUE)

meta <- pin_meta(board, name)
testthat::expect_equal(meta$title, "xxx-b1")
Expand Down

0 comments on commit 5537ce4

Please sign in to comment.