Cache the promise, not the Window object
Add unit tests