Closed ahctangU closed 1 year ago
I don't mock it. Instead, for functions that generate ids, I take the id as an optional parameter. When the id is not passed in, call cuid to generate it. In unit tests, I just pass the id in.
Alternatively, you can copy the id from the actual results before running your expectations. I have never needed to mock cuid.
It seems like due to the way the modules are exported the usual ways for exporting via jest don't work? Or is there something really obvious that I haven't found?