diff options
| author | Leitwolf | 2026-10-03 06:14:22 +0300 |
|---|---|---|
| committer | GitHub | 2026-10-03 06:14:22 +0300 |
| commit | 3bb41fe5c59dcf25edfd868e0d6eca67e4a6e504 (patch) | |
| tree | f5299c72014e9cb4a041a6260140d49786052bfd /frontend | |
| parent | 2803ded0dff517e51b874dfbbfae76018a05ad8a (diff) | |
| parent | c053e6a6932219cbe345d5ff47dcdf0da32559cf (diff) | |
| download | website-3bb41fe5c59dcf25edfd868e0d6eca67e4a6e504.tar.gz | |
Merge pull request #11 from Progmasoft/fix/forum-asset-cache-key
Give the forum assets a cache key
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/tests/site-integrity.test.mjs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/frontend/tests/site-integrity.test.mjs b/frontend/tests/site-integrity.test.mjs index 6da461d..114b0cc 100644 --- a/frontend/tests/site-integrity.test.mjs +++ b/frontend/tests/site-integrity.test.mjs @@ -34,12 +34,15 @@ test("the forum placeholder is explicitly non-indexable and not an account servi assert.match(nginx, /X-Robots-Tag "noindex, nofollow"/); assert.match(nginx, /script-src 'self'; style-src 'self'/); assert.doesNotMatch(nginx, /unsafe-inline/); - assert.match(forum, /src="\/site\.js"/); - assert.match(forum, /href="\/site\.css"/); + assert.match(forum, /src="\/site\.js[?"]/); + assert.match(forum, /href="\/site\.css[?"]/); const normalizedForum = forum.toLowerCase(); assert.equal(normalizedForum.split("<script").length - 1, 1); assert.equal(normalizedForum.split("</script>").length - 1, 1); - assert.ok(normalizedForum.includes('<script src="/site.js" defer></script>')); + // The query string is a cache key for the edge cache. Nginx serves the + // exact file path, so changing the value forces a fresh copy after a deploy. + assert.match(normalizedForum, /<script src="\/site\.js\?v=[0-9-]+" defer><\/script>/); + assert.match(normalizedForum, /<link rel="stylesheet" href="\/site\.css\?v=[0-9-]+" \/>/); assert.doesNotMatch(forum, /<form\b/); }); |