Skip to content

Commit

Permalink
remove class before testing if validate output is false
Browse files Browse the repository at this point in the history
A weird bug just popped up and I don't know where it's coming from, but
effectively, when a value with a class of "error" is passed to
`encodeString()`, it fails with:

Error in UseMethod("conditionMessage") :
  no applicable method for 'conditionMessage' applied to an object of class "error"

This never used to happen, so I'm fixing it here.
  • Loading branch information
zkamvar authored and annakrystalli committed Dec 18, 2024
1 parent 8c22f2d commit 34f2624
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-validate_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test_that("Missing files returns an invalid config with an immediate message", {
suppressMessages({
expect_message(out <- validate_config(hub_path = tmp), "File does not exist")
})
expect_false(out)
expect_false(unclass(out))
})
test_that("Config for samples fail correctly", {
skip_if_offline()
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-validate_model_metadata_schema.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_that("Missing files returns an invalid config with an immediate message", {
"File does not exist"
)
})
expect_false(out)
expect_false(unclass(out))
})

test_that("validate_model_metadata_schema works", {
Expand All @@ -28,7 +28,7 @@ test_that("validate_model_metadata_schema works", {
)
)
)
expect_false(out_error)
expect_false(unclass(out_error))
expect_snapshot(out_error) # prints .Last.value
expect_snapshot(print(out_error)) # prints out_error
expect_snapshot(str(attr(out_error, "errors")))
Expand All @@ -51,6 +51,6 @@ test_that("validate_model_metadata_schema errors for imparsable json", {
"SyntaxError"
)
})
expect_false(out)
expect_false(unclass(out))

})

0 comments on commit 34f2624

Please sign in to comment.