Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend/../Banner.test.js: change replace window.history.pushState(.…
…..) with `window.location` method used in List.test.js [+] Reasons: - Consistency with List.test.js - Altering `window` with custom `location` is the method used by Facebook, the owners of Jest: jestjs/jest#890 (note that the original method stopped working -- see jestjs/jest#5124) - `window.history.pushState` simulates something slightly different than what we are testing for, and in a real browser changes state and also triggers events. While here in these tests we are not dealing with a browser `window` object but the one provided by jsdom, it would still seem more brittle, because whether or not the jsdom project implements history to work the way it does in actual browsers, it might have an API in flux, and we don't want to have to keep track of the fluctuations and potential side effects. The `delete window.location` followed by replacement with our own `location` is not subject to changes to the jsdom API (in theory, although see the 2nd link in the previous point).
- Loading branch information