import { cleanup, render, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import DeprecationNotice from '../deprecation-notice' vi.mock('@/next/link', () => ({ default: ({ children, href }: { children: React.ReactNode, href: string }) => ( {children} ), })) describe('DeprecationNotice', () => { beforeEach(() => { vi.clearAllMocks() }) afterEach(() => { cleanup() }) it('returns null when status is not "deleted"', () => { const { container } = render( , ) expect(container.firstChild).toBeNull() }) it('renders deprecation notice when status is "deleted"', () => { render( , ) expect(screen.getByText('plugin.detailPanel.deprecation.noReason')).toBeInTheDocument() }) it('renders with valid reason and alternative plugin', () => { render( , ) expect(screen.getByText('detailPanel.deprecation.fullMessage')).toBeInTheDocument() }) it('renders only reason without alternative plugin', () => { render( , ) expect(screen.getByText(/plugin\.detailPanel\.deprecation\.onlyReason/)).toBeInTheDocument() }) it('renders no-reason message for invalid reason', () => { render( , ) expect(screen.getByText('plugin.detailPanel.deprecation.noReason')).toBeInTheDocument() }) it('applies custom className', () => { const { container } = render( , ) expect((container.firstChild as HTMLElement).className).toContain('my-custom-class') }) })