fix: remediate branch review findings

This commit is contained in:
Josh Creek
2026-09-14 11:47:58 +01:00
parent 4af33709a3
commit 86f1c21e4d
38 changed files with 65833 additions and 58545 deletions
+7 -4
View File
@@ -29,13 +29,16 @@ describe(`test-build: ${nodeAdapter ? 'node' : 'static'} adapter`, () => {
match && match.length === 1,
'missing manifest.webmanifest in sw precache manifest'
).toBeTruthy();
// The generateSW manifest is emitted as JSON ("url": "/"), while prompt-sw.ts's own
// `precache([{ url: '/' }])` survives minification as an unquoted key (url:"/").
match = swContent.match(/"?url"?:\s*"(?:\/|index\.html)"/);
match = swContent.match(/"?url"?:\s*"\/?offline(?:\.html)?"/);
expect(
match && match.length === 1,
'missing offline entry point in sw precache manifest'
'missing credential-free offline entry point in sw precache manifest'
).toBeTruthy();
const outputRoot = `./build/${nodeAdapter ? 'client/' : ''}`;
expect(existsSync(`${outputRoot}offline.html`)).toBe(true);
expect(existsSync(`${outputRoot}offline-worker.js`)).toBe(true);
expect(existsSync(`${outputRoot}service-worker.js`)).toBe(false);
expect(swContent).not.toMatch(/"?url"?:\s*"\/"/);
if (nodeAdapter) {
match = swContent.match(/"url":\s*"server\//);
expect(match === null, 'found server/ entries in sw precache manifest').toBeTruthy();