Relative Content

Tag Archive for javascriptreactjstestingjestjs

Test that a function exported from inside a hook is called

I’m trying to test that a function, which is defined inside of a hook, is called in a component that uses that hook/function. I’m familiar with mocking simple modules/functions, but this scenario has me confused as I don’t know how to mock only a single returned function from that hook without losing all of the other functions/logic in that hook, which I don’t want to mock.