import React from 'react'
import { afterEach, describe, expect, it } from 'vitest'
import { cleanup, render, screen } from '@testing-library/react'
import CreatorSpotlight from './CreatorSpotlight'
describe('CreatorSpotlight related rail', () => {
afterEach(() => {
cleanup()
})
it('shows only artworks from the same author id', () => {
render(
,
)
expect(screen.getByText(/more from psych0/i)).not.toBeNull()
expect(screen.getByRole('link', { name: /same author work/i }).getAttribute('href')).toBe('/art/101/same-author-work')
expect(screen.queryByRole('link', { name: /wrong author work/i })).toBeNull()
})
it('hides the rail when there are no same-author works', () => {
render(
,
)
expect(screen.queryByText(/more from psych0/i)).toBeNull()
expect(screen.queryByRole('link', { name: /wrong author work/i })).toBeNull()
})
})