Defer artwork comments from initial render
This commit is contained in:
@@ -42,7 +42,7 @@ describe('ArtworkRecommendationsRails', () => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
it('loads recommendation rails after mount', async () => {
|
||||
it('loads normal trending rails after mount without owning Similar-AI loading', async () => {
|
||||
render(
|
||||
<ArtworkRecommendationsRails
|
||||
artwork={{
|
||||
@@ -51,6 +51,13 @@ describe('ArtworkRecommendationsRails', () => {
|
||||
categories: [{ id: 5, name: 'Sci-Fi' }],
|
||||
}}
|
||||
related={[]}
|
||||
trendingData={[{
|
||||
id: 11,
|
||||
title: 'Star map drift',
|
||||
urls: { direct: '/art/11/star-map-drift' },
|
||||
author: { name: 'Pilot' },
|
||||
thumbnail_url: '/thumbs/11.webp',
|
||||
}]}
|
||||
/>,
|
||||
)
|
||||
|
||||
@@ -58,7 +65,7 @@ describe('ArtworkRecommendationsRails', () => {
|
||||
expect(screen.getByText('Trending in Sci-Fi')).not.toBeNull()
|
||||
})
|
||||
|
||||
expect(global.fetch).toHaveBeenCalledWith('/api/art/69827/similar-ai', { credentials: 'same-origin' })
|
||||
expect(global.fetch).toHaveBeenCalledWith('/api/rank/category/5?type=trending', { credentials: 'same-origin' })
|
||||
expect(global.fetch).not.toHaveBeenCalledWith('/api/art/69827/similar-ai', { credentials: 'same-origin' })
|
||||
expect(global.fetch).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user