Skip to content

Commit a403793

Browse files
thavelickclaude
andcommitted
Fix code formatting and linting issues
- Apply biome formatting for consistent code style - Fix unused parameter warning in test cases 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 38b4cc0 commit a403793

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

public_html/search.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,18 @@ async function registerServiceWorker(windowObj = window) {
189189

190190
function shouldEnableCaching(windowObj = window) {
191191
const urlParams = new URLSearchParams(windowObj.location.search);
192-
const cacheParam = urlParams.get('cache');
193-
192+
const cacheParam = urlParams.get("cache");
193+
194194
// Explicit override via URL parameter
195-
if (cacheParam === 'force') return true;
196-
if (cacheParam === 'disable') return false;
197-
195+
if (cacheParam === "force") return true;
196+
if (cacheParam === "disable") return false;
197+
198198
// Default: disable caching on local development
199-
const isLocal = windowObj.location.hostname === 'localhost' ||
200-
windowObj.location.hostname === '127.0.0.1' ||
201-
windowObj.location.hostname.startsWith('192.168.');
202-
199+
const isLocal =
200+
windowObj.location.hostname === "localhost" ||
201+
windowObj.location.hostname === "127.0.0.1" ||
202+
windowObj.location.hostname.startsWith("192.168.");
203+
203204
return !isLocal;
204205
}
205206

tests/search.spec.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -814,19 +814,27 @@ describe("Settings Functions", () => {
814814
const testCases = [
815815
// [hostname, queryString, expected, description]
816816
["localhost", "?cache=force", true, "cache=force parameter returns true"],
817-
["example.com", "?cache=disable", false, "cache=disable parameter returns false"],
817+
[
818+
"example.com",
819+
"?cache=disable",
820+
false,
821+
"cache=disable parameter returns false",
822+
],
818823
["localhost", "", false, "localhost hostname returns false"],
819824
["127.0.0.1", "", false, "127.0.0.1 hostname returns false"],
820825
["192.168.1.100", "", false, "192.168.x hostname returns false"],
821826
["example.com", "", true, "production hostname returns true"],
822827
];
823828

824-
test.each(testCases)("hostname: %s, query: %s -> %s (%s)", (hostname, search, expected, description) => {
825-
const mockWindow = {
826-
location: { hostname, search },
827-
};
829+
test.each(testCases)(
830+
"hostname: %s, query: %s -> %s (%s)",
831+
(hostname, search, expected, _description) => {
832+
const mockWindow = {
833+
location: { hostname, search },
834+
};
828835

829-
expect(shouldEnableCaching(mockWindow)).toBe(expected);
830-
});
836+
expect(shouldEnableCaching(mockWindow)).toBe(expected);
837+
},
838+
);
831839
});
832840
});

0 commit comments

Comments
 (0)