| 1441 | |
| 1442 | #[test] |
| 1443 | fn test_tsx_support() { |
| 1444 | let mut extractor = TypeScriptExtractor::new_tsx(); |
| 1445 | let source = r#" |
| 1446 | export function Button({ onClick, children }: ButtonProps): JSX.Element { |
| 1447 | return <button onClick={onClick}>{children}</button>; |
| 1448 | } |
| 1449 | |
| 1450 | export const Card: React.FC<CardProps> = ({ title, content }) => { |
| 1451 | return ( |
| 1452 | <div className="card"> |
| 1453 | <h2>{title}</h2> |
| 1454 | <p>{content}</p> |
| 1455 | </div> |
| 1456 | ); |
| 1457 | }; |
| 1458 | "#; |
| 1459 | let entities = extractor.extract(source, "test.tsx"); |
| 1460 | |
| 1461 | assert_eq!(entities.len(), 2); |
| 1462 | assert!(entities.iter().any(|e| e.name == "Button")); |
| 1463 | assert!(entities.iter().any(|e| e.name == "Card")); |
| 1464 | } |
| 1465 | |
| 1466 | #[test] |
| 1467 | fn test_line_numbers() { |