/**
 * Export-presence test for the Primitives adapter (UX-9.2).
 *
 * A pure import test: it asserts every runtime (value) export of
 * `src/components/ui/Primitives.tsx` is defined. This lifts the adapter off
 * 0% coverage without needing `@testing-library/react` or a DOM environment,
 * and guards against an accidental broken/renamed re-export from `@bytelyst/ui`.
 *
 * @see docs/roadmaps/UX_INTEGRATION_BYTELYST.md (UX-9)
 */

import { describe, it, expect } from 'vitest';
import * as Primitives from '@/components/ui/Primitives';

// Every value (non-type) export the adapter is expected to provide.
const EXPECTED_EXPORTS = [
  // UX-1 baseline
  'Button',
  'Input',
  'Field',
  'FieldContent',
  'FieldDescription',
  'FieldError',
  'FieldGroup',
  'FieldLabel',
  'FieldTitle',
  'Modal',
  'ConfirmDialog',
  'Badge',
  'StatusBadge',
  'StatusDot',
  'EmptyState',
  'Skeleton',
  'SkeletonGroup',
  'TableSkeleton',
  'MetricCard',
  'Toast',
  'ToastProvider',
  'useToast',
  'toast',
  'dismissToast',
  // UX-9.1 additions
  'Select',
  'Textarea',
  'Checkbox',
  'Switch',
  'RadioGroup',
  'RadioGroupItem',
  'Tooltip',
  'TooltipContent',
  'TooltipProvider',
  'TooltipTrigger',
  'Tabs',
  'TabsContent',
  'TabsList',
  'TabsTrigger',
  'SegmentedControl',
  'DropdownMenu',
  'DropdownMenuContent',
  'DropdownMenuGroup',
  'DropdownMenuItem',
  'DropdownMenuLabel',
  'DropdownMenuRadioGroup',
  'DropdownMenuSeparator',
  'DropdownMenuSub',
  'DropdownMenuSubTrigger',
  'DropdownMenuTrigger',
  'Drawer',
  'ActionMenu',
  'IconButton',
  'AlertBanner',
  'Card',
  'CardHeader',
  'CardTitle',
  'CardDescription',
  'Panel',
  'PanelBody',
  'PanelDescription',
  'PanelHeader',
  'PanelTitle',
  'Separator',
  'DataList',
  'DataListItem',
  'DataListMeta',
  'Timeline',
  // UX-8 AppShell additions
  'AppShell',
  'AppShellMain',
  'AppShellMobileToggle',
  'AppShellNav',
  'AppShellNavItem',
  'AppShellOverlay',
  'AppShellPageHeader',
  'AppShellSidebar',
  'AppShellSkipLink',
] as const;

describe('Primitives adapter — export presence', () => {
  it.each(EXPECTED_EXPORTS)('re-exports %s as a defined value', name => {
    expect((Primitives as Record<string, unknown>)[name]).toBeDefined();
  });

  it('exposes the toast helpers as callable functions', () => {
    expect(typeof Primitives.toast).toBe('function');
    expect(typeof Primitives.dismissToast).toBe('function');
    expect(typeof Primitives.useToast).toBe('function');
  });
});
