Closed ddfridley closed 2 years ago
How do you interface with the status methods from a jest test? Since it's a react hook (useMethods), it isn't callable inside of a normal unit test.
@kamui-fin a fair point. useMethods takes a function, which returns an object that has all the functions as properties. Perhaps the jest test should call that function, passing it's own dispatch function and state. And then test the functions. Or the functions could be exported from where they are and imported by the jest test.
The interface/pattern to be compatible with useMethods (see below)
app/lib/get-election-status-methods.js
[ ] Do a couple status methods and make sure it works before doing the whole thing to make sure this pattern for pulling the methods into useMethods actually works.
[ ] Then update navigation-panel to use the methods out of electionMethods.
[ ] create jest tests for each method in:
app/lib/tests/get-election-status-methods-[method-name].js where [method-name] is one of the methods in the file see cloudinary-urls.test.js for an example of writing a test. see Testing for more on tests