That’s a lot of mocking.
I’ve written code much like this. My realization is that it’s always hard to retrofit tests onto an already existing app. I’d call this top down testing. Bottom of up testing would have a renderer and data source which could be developed and tested independently. My tests wouldn’t include mocks as such but instead a simple “json renderer” which recorded the data we rendered (in this case a color) and a “static” datasource which returned the same time passed in.
The end result might look similar but we’ve gone from mocking out random parts of the DOM to substituting trivial implementations of high level services. It also wouldn’t depend on global state which is the devil ™