nhs-r-community / NHSRplotthedots

An SPC package to support NHSE/I 'Making Data Count' programme
https://nhs-r-community.github.io/NHSRplotthedots/
Other
47 stars 21 forks source link

internal: replace mockery functions in package tests with testthat::with_mocked_bindings() #212

Closed francisbarton closed 1 month ago

francisbarton commented 1 month ago

with_mocked_bindings() and local_mocked_bindings() provide tools for "mocking", temporarily redefining a function so that it behaves differently during tests. This is helpful for testing functions that depend on external state (i.e. reading a value from a file or a website, or pretending a package is or isn't installed).

These functions represent a second attempt at bringing mocking to testthat, incorporating what we've learned from the mockr, mockery, and mockthat packages.

https://testthat.r-lib.org/reference/local_mocked_bindings.html

This package is superseded and we no longer recommend that you use it for new tests. We instead recommend testthat::local_mocked_bindings().

https://github.com/r-lib/mockery

francisbarton commented 1 month ago

Sorry, not sure this is a priority!