Defer artwork comments from initial render

This commit is contained in:
2026-08-29 12:07:08 +02:00
parent 8a80aae21e
commit 4ab315e9d7
8 changed files with 267 additions and 138 deletions
@@ -51,7 +51,7 @@ describe('Context navigation — useNavContext', () => {
})
it('resolves prev/next IDs from the same-user API', async () => {
const apiData = { prev_id: 100, next_id: 300, prev_url: '/art/100', next_url: '/art/300' }
const apiData = { prev_id: 100, next_id: 300, prev_url: '/art/100', next_url: '/art/300', prev_slug: 'prev', next_slug: 'next' }
mockFetch(apiData)
const { useNavContext } = await import('../../lib/useNavContext')
@@ -99,7 +99,7 @@ describe('Fallback — API navigation when no sessionStorage context', () => {
it('calls /api/artworks/navigation/{id} when sessionStorage is empty', async () => {
mockSessionStorage(null)
const apiData = { prev_id: 50, next_id: 150, prev_url: '/art/50', next_url: '/art/150' }
const apiData = { prev_id: 50, next_id: 150, prev_url: '/art/50', next_url: '/art/150', prev_slug: 'prev', next_slug: 'next' }
mockFetch(apiData)
const { useNavContext } = await import('../../lib/useNavContext')
@@ -143,6 +143,7 @@ describe('Fallback — API navigation when no sessionStorage context', () => {
await waitFor(() => expect(screen.getByTestId('result')).not.toBeNull())
expect(screen.getByTestId('result').textContent).toBe('null|null')
})
})
// ─── 3. Keyboard Test ─────────────────────────────────────────────────────────