Updated tests to mock new immutable window location object

This commit is contained in:
alexjanousekGSA
2025-06-16 19:33:32 -04:00
parent b4b8435fb7
commit a57811a8a8
2 changed files with 86 additions and 89 deletions

View File

@@ -1,17 +0,0 @@
// 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
},
})