commit d859520f578dcd7e793a021aad12db1c6d933435
parent c38b78cbb36aeba32b6505cf28f68e1b3dee8eb7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 26 Sep 2026 00:48:22 -0400
common: the token-sheet parser's comment names the nested @media rule; the SW test's duplicate failed-fetch case becomes the no-cache network-error branch (brand S3 review)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/common/components/themeTokens.test.ts b/common/components/themeTokens.test.ts
@@ -25,8 +25,9 @@ const CSS = readFileSync(
type Rule = { selector: string; decls: Map<string, string>; index: number; body: string };
-// Top-level rules only (the sheet has no nesting beyond `@theme inline`, which
-// is an at-rule and skipped). Comments are stripped first.
+// Top-level rules only. An at-rule (`@theme inline`, the `@media` block) gets no
+// declarations but keeps its raw `body`, which a test can parse again for the
+// rules nested in it. Comments are stripped first.
function parseRules(css: string): Rule[] {
const src = css.replace(/\/\*[\s\S]*?\*\//g, "");
const rules: Rule[] = [];
diff --git a/common/lib/archive/serviceWorkerRouting.test.ts b/common/lib/archive/serviceWorkerRouting.test.ts
@@ -121,12 +121,12 @@ for (const file of ["export/service-worker/site-sw.js", "export/service-worker/s
assert.equal(await sw.request("/icons/icon-192.png", { online: false }), "cached icon");
});
- test(`${file}: a failed online icon fetch falls back to the cached icon`, async () => {
+ test(`${file}: a failed icon fetch with nothing cached is a network error, not a cached miss`, async () => {
+ // The first test's offline half covers a failed fetch WITH a cached icon.
const sw = loadWorker(file);
- sw.seed("shell-v2", "/icons/icon.svg", "cached icon");
- assert.equal(await sw.request("/icons/icon.svg", { online: false }), "cached icon");
+ assert.equal(await sw.request("/icons/icon.svg", { online: false }), "<error>");
assert.deepEqual(sw.fetched, ["/icons/icon.svg"]);
- assert.equal(sw.cached("shell-v2", "/icons/icon.svg"), "cached icon");
+ assert.equal(sw.cached("shell-v2", "/icons/icon.svg"), undefined);
});
test(`${file}: /_next/static/ stays cache-first`, async () => {