diff --git a/src/test/components/imprint.spec.tsx b/src/test/components/imprint.spec.tsx index b3e8452..003671c 100644 --- a/src/test/components/imprint.spec.tsx +++ b/src/test/components/imprint.spec.tsx @@ -36,10 +36,13 @@ describe("imprint.tsx", () => { // @ts-ignore delete window.location; - window.location = { - ...location, - reload: jest.fn(), - }; + Object.defineProperty(window, "location", { + configurable: true, + value: { + ...window.location, + reload: jest.fn(), + }, + }); }); it("Tests Imprint", () => { diff --git a/src/test/components/searchBar.spec.tsx b/src/test/components/searchBar.spec.tsx index 3c59f80..1eb2fb4 100644 --- a/src/test/components/searchBar.spec.tsx +++ b/src/test/components/searchBar.spec.tsx @@ -48,10 +48,13 @@ describe("searchBar.tsx", () => { // @ts-ignore delete window.location; - window.location = { - ...location, - reload: jest.fn(), - }; + Object.defineProperty(window, "location", { + configurable: true, + value: { + ...window.location, + reload: jest.fn(), + }, + }); }); it("Tests SearchBar rendering with properties", () => { diff --git a/src/test/components/settings.spec.tsx b/src/test/components/settings.spec.tsx index 56dd8dd..4847a18 100644 --- a/src/test/components/settings.spec.tsx +++ b/src/test/components/settings.spec.tsx @@ -78,10 +78,13 @@ describe("settings.tsx", () => { // @ts-ignore delete window.location; - window.location = { - ...location, - reload: jest.fn(), - }; + Object.defineProperty(window, "location", { + configurable: true, + value: { + ...window.location, + reload: jest.fn(), + }, + }); }); it("Tests forms", () => { diff --git a/src/test/lib/useTheme.spec.tsx b/src/test/lib/useTheme.spec.tsx index 250dea4..651fa58 100644 --- a/src/test/lib/useTheme.spec.tsx +++ b/src/test/lib/useTheme.spec.tsx @@ -21,10 +21,13 @@ const setup = () => { // @ts-ignore delete window.location; - window.location = { - ...location, - reload: jest.fn(), - }; + Object.defineProperty(window, "location", { + configurable: true, + value: { + ...window.location, + reload: jest.fn(), + }, + }); }; describe("theme.tsx", () => {