Recently, I needed to test a button that would make an analytics tracking call using react-tracking and then navigate to a new page in a callback. This presented some challenges - I wasn’t sure how to create a mocked version of react-tracking that would allow a callback to be passed.
With some help from fellow Artsy engineers Christopher Pappas and Pavlos Vinieratos, I got the tracking and testing to work. Here’s how we did it.