connectapi icon indicating copy to clipboard operation
connectapi copied to clipboard

test: Don't expect_error() without asserting the message

Open nealrichardson opened this issue 1 year ago • 1 comments

I fixed one issue recently where there was a syntax error in the error message construction, so instead of showing the expected message, it was showing a string interpolation error. But the test we had for that case was just doing expect_error(), so it was passing. We should generally assert something about the error message so that we know the expected error is happening.

nealrichardson avatar Apr 29 '24 17:04 nealrichardson

The only examples of this I could find were:

https://github.com/rstudio/connectapi/blob/b98e430c101c59b72b5f5a988906f4146612f535/tests/testthat/test-content.R#L12-L20

Gonna fix those in January. There are also some terse assertions of substrings, but those should be fine.

toph-allen avatar Dec 20 '24 20:12 toph-allen