Files
notifications-admin/tests/javascripts/support/polyfills.js
Carlo Costino a46a21a519 Revert recent changes for window location updates
There are a few other things at play that will require more investigation at a future date:

- Why window.location.assign() or history.pushState() do not work
- If any other config or polyfills are needed with JSDOM

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2023-10-12 10:00:30 -04:00

18 lines
421 B
JavaScript

// Polyfills for any parts of the DOM API available in browsers but not JSDOM
let _location = {
reload: jest.fn(),
hostname: "beta.notify.gov",
assign: jest.fn(),
href: "https://beta.notify.gov",
}
// JSDOM provides a read-only window.location, which does not allow for
// mocking or setting.
Object.defineProperty(window, 'location', {
get: () => _location,
set: (value) => {
_location = value
},
})