From 321700a713af842cb90188c3aa18e5adba54ce92 Mon Sep 17 00:00:00 2001 From: Alexander Sullivan Date: Tue, 2 Dec 2025 21:40:08 -0500 Subject: [PATCH 1/4] fix sw --- README.md | 2 +- cypress/e2e/landing.cy.js | 13 +- index.html | 8 - package-lock.json | 2128 +++++++++++++++++++------------------ package.json | 14 +- src/scripts/index.js | 23 +- src/scripts/index.min.js | 2 +- src/scripts/index.test.js | 29 + 8 files changed, 1163 insertions(+), 1056 deletions(-) diff --git a/README.md b/README.md index 24d19b8..a1ca6cd 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ To visit specific articles, just change the directory to end with '?' + article | Chrome | Firefox | Edge | Safari | Opera | Mobile | | ------ | ------- | ---- | ------ | ----- | ------ | -| ✔ | ✔ | ✔ | ? | ✔ | ✔ | +| ✔ | ✔ | ✔ | ? | ✔ | ✔ | ## Known issues diff --git a/cypress/e2e/landing.cy.js b/cypress/e2e/landing.cy.js index 8743e67..fa7f6c9 100644 --- a/cypress/e2e/landing.cy.js +++ b/cypress/e2e/landing.cy.js @@ -30,7 +30,18 @@ describe("Landing Page", () => { it("should show error when article is missing", () => { // Simulate navigating to a missing article - cy.visit("http://localhost:3000/index.html?NonExistentArticle"); + cy.visit("http://localhost:3000/index.html?NonExistentArticle", { + onBeforeLoad(win) { + // Simulate service worker registration throwing a disallowed redirect error + Object.defineProperty(win.navigator, "serviceWorker", { + value: { + register: () => Promise.reject(new Error("disallowed redirect")), + }, + writable: true, + }); + }, + }); + cy.get("#articleBody").should("contain", "Error retrieving article"); cy.get("#articleBody").should("be.visible"); }); diff --git a/index.html b/index.html index 9e26957..239b6d4 100644 --- a/index.html +++ b/index.html @@ -115,14 +115,6 @@ -