mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
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>
18 lines
421 B
JavaScript
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
|
|
},
|
|
})
|