There may be a situation where you need to mock methods or properties on window.location in Jest. However, because of peculiarities of jsdom, this could be challenging. In this post there is one of the possible solutions to this problem.
Store FormData object in localStorage
This post describes how to serialize a FormData object to JSON and how to fill the form back with the serialized data.