From be0f73d1bcbfbda665631d43132c009d5a711c41 Mon Sep 17 00:00:00 2001 From: Codex Night Worker Date: Fri, 13 Nov 2026 12:39:11 +0900 Subject: [PATCH] AI: address review on PR #460 --- frontend/server.ssr.test.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend/server.ssr.test.mjs b/frontend/server.ssr.test.mjs index cae7986..530949c 100644 --- a/frontend/server.ssr.test.mjs +++ b/frontend/server.ssr.test.mjs @@ -2,6 +2,7 @@ import assert from 'node:assert/strict' import { createServer } from 'node:http' import { spawn } from 'node:child_process' import { after, before, test } from 'node:test' +import { JSDOM } from 'jsdom' import { createServer as createViteServer } from 'vite' import { render } from './dist/server/entry-server.js' @@ -402,6 +403,26 @@ test ('every canonical screen route returns page HTML without JavaScript', async } }) +test ('SSR HTML head includes reciprocal hreflang links with query parameters', async () => { + for (const locale of ['ja', 'ain-Kana']) { + const response = await fetch (`${httpOrigin}/${locale}/posts?page=2&limit=50`) + assert.equal (response.status, 200) + const dom = new JSDOM (await response.text ()) + try + { + const links = [...dom.window.document.head.querySelectorAll ('link[rel="alternate"]')] + assert.deepEqual (links.map (link => ({ + locale: link.getAttribute ('hreflang'), href: link.getAttribute ('href') })), [ + { locale: 'ja', href: `${origin}/ja/posts?page=2&limit=50` }, + { locale: 'ain-Kana', href: `${origin}/ain-Kana/posts?page=2&limit=50` }]) + } + finally + { + dom.window.close () + } + } +}) + test ('YouTube posts return HTTP 200 with the embed rendered by SSR', async t => { for (const locale of ['ja', 'ain-Kana']) { await t.test (locale, async () => {