| 1469 | |
| 1470 | #[test] |
| 1471 | fn test_tsx_support() { |
| 1472 | let mut extractor = TypeScriptExtractor::new_tsx(); |
| 1473 | let source = r#" |
| 1474 | export function Button({ onClick, children }: ButtonProps): JSX.Element { |
| 1475 | return <button onClick={onClick}>{children}</button>; |
| 1476 | } |
| 1477 | |
| 1478 | export const Card: React.FC<CardProps> = ({ title, content }) => { |
| 1479 | return ( |
| 1480 | <div className="card"> |
| 1481 | <h2>{title}</h2> |
| 1482 | <p>{content}</p> |
| 1483 | </div> |
| 1484 | ); |
| 1485 | }; |
| 1486 | "#; |
| 1487 | let entities = extractor.extract(source, "test.tsx"); |
| 1488 | |
| 1489 | assert_eq!(entities.len(), 2); |
| 1490 | assert!(entities.iter().any(|e| e.name == "Button")); |
| 1491 | assert!(entities.iter().any(|e| e.name == "Card")); |
| 1492 | } |
| 1493 | |
| 1494 | #[test] |
| 1495 | fn test_line_numbers() { |