TypeError: scrollIntoView is not a function
If we want to unit test 'scrollIntoView' function in a react application using react testing library then we can mock the function using 'jest'.
window.HTMLElement.prototype.scrollIntoView = jest.fn()
scrollIntoView
is not implemented in jsdom. Here's the issue: link.
You might get it working by manually adding it:
window.HTMLElement.prototype.scrollIntoView = function() {};