jest-location-mock icon indicating copy to clipboard operation
jest-location-mock copied to clipboard

window.history.pushState not working as expected

Open saravntbe opened this issue 1 year ago • 2 comments

window.history.pushState not working as expected when jest-location-mock is used. clone this repo to reproduce. example (below test fails.)

test('route should be changed', ()=>{
     window.history.pushState({}, 'Test page', '/123')
     expect(window.location.href).toEqual('http://localhost/123')
 })

saravntbe avatar Sep 26 '22 09:09 saravntbe

Currently, this project only mocks window.location and not the history or navigation APIs. This would be a good future feature 😸

evelynhathaway avatar Sep 29 '22 04:09 evelynhathaway