import { describe, test, expect } from 'vitest'; import { render, screen } from '@testing-library/svelte'; import PlaylistPlaceholderCard from './PlaylistPlaceholderCard.svelte'; describe('PlaylistPlaceholderCard', () => { test('renders label', () => { render(PlaylistPlaceholderCard, { props: { label: 'For You', variant: 'pending' } }); expect(screen.getByText('For You')).toBeInTheDocument(); }); test('building variant shows building copy and pulses', () => { const { container } = render(PlaylistPlaceholderCard, { props: { label: 'For You', variant: 'building' } }); expect(screen.getByText(/Building your daily mix/i)).toBeInTheDocument(); const cover = container.querySelector('[data-variant="building"] .aspect-square'); expect(cover?.className).toMatch(/animate-pulse/); }); test('failed variant shows failure copy and does NOT pulse', () => { const { container } = render(PlaylistPlaceholderCard, { props: { label: 'For You', variant: 'failed' } }); expect(screen.getByText(/Couldn.t build this mix/i)).toBeInTheDocument(); const cover = container.querySelector('[data-variant="failed"] .aspect-square'); expect(cover?.className).not.toMatch(/animate-pulse/); }); test('seed-needed variant shows variety copy', () => { render(PlaylistPlaceholderCard, { props: { label: 'Songs like…', variant: 'seed-needed' } }); expect(screen.getByText(/Listen to more variety/i)).toBeInTheDocument(); }); test('pending variant (default) shows within-24h copy and pulses', () => { const { container } = render(PlaylistPlaceholderCard, { props: { label: 'For You' } }); expect(screen.getByText(/within 24h/i)).toBeInTheDocument(); const cover = container.querySelector('[data-variant="pending"] .aspect-square'); expect(cover?.className).toMatch(/animate-pulse/); }); });