How to mock window object in Jest with deep-rooted methods called
Recently I have some unit tests need to mock window object and implement some methods of it, and it is a deep-rooted object which is hard to mock but luckily I found some useful document and winged a bit and then boom! Happy Ending!
I was implementing a payment solution where it requires a Flex
object in the window
object and Jest gives an official…