mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
Switch to jest.spyOn() for window.location
The previous comment was incorrect, so there's no need to use the defineObject hack, or to populate the object beforehand.
This commit is contained in:
@@ -46,12 +46,9 @@ describe('Register security key', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// pretend window.location exists in test env
|
||||
Object.defineProperty(window, 'location', {
|
||||
jest.spyOn(window.location, 'reload').mockImplementation(() => {
|
||||
// signal that the async promise chain was called
|
||||
value: { reload: () => done() },
|
||||
// allow global property to be redefined in other tests
|
||||
writable: true,
|
||||
done()
|
||||
})
|
||||
|
||||
jest.spyOn(window, 'fetch').mockImplementation((_url, options = {}) => {
|
||||
|
||||
Reference in New Issue
Block a user