AI: address issue #483

このコミットが含まれているのは:
Codex Night Worker
2026-11-17 04:09:38 +09:00
コミット 9c71a9fc02
7個のファイルの変更、358行の追加、46行の削除
+16
ファイルの表示
@@ -56,4 +56,20 @@ describe ('Portable static mirror assets', () => {
expect (document.querySelector ('a:not([data-original])'))
.toHaveAttribute ('href', 'ja/posts/index.html')
})
it.each (['tag name', 'alias']) ('finds linked posts by %s', async query => {
const input = document.querySelector ('input')!
input.value = query
vi.stubGlobal ('fetch', vi.fn ().mockResolvedValue ({ ok: true, json: async () => [
{ path: 'ja/posts/1/index.html', title: 'Post title', names: ['Tag Name', 'Alias'] },
{ path: 'ja/posts/2/index.html', title: 'Unrelated post', names: ['Other tag'] },
{ path: 'ja/tags/1/index.html', title: 'Tag Name', names: ['Tag Name', 'Alias'] }] }))
new Function (script) ()
fireEvent.submit (document.querySelector ('form')!)
await waitFor (() => expect (document.querySelectorAll ('#search-results a')).toHaveLength (2))
const links = [...document.querySelectorAll ('#search-results a')]
expect (links.map (link => link.getAttribute ('href')))
.toEqual (['ja/posts/1/index.html', 'ja/tags/1/index.html'])
expect (links[0].textContent).toBe ('Post title')
})
})