| 1396 | |
| 1397 | #[test] |
| 1398 | fn test_tsx_support() { |
| 1399 | let mut extractor = TypeScriptExtractor::new_tsx(); |
| 1400 | let source = r#" |
| 1401 | export function Button({ onClick, children }: ButtonProps): JSX.Element { |
| 1402 | return <button onClick={onClick}>{children}</button>; |
| 1403 | } |
| 1404 | |
| 1405 | export const Card: React.FC<CardProps> = ({ title, content }) => { |
| 1406 | return ( |
| 1407 | <div className="card"> |
| 1408 | <h2>{title}</h2> |
| 1409 | <p>{content}</p> |
| 1410 | </div> |
| 1411 | ); |
| 1412 | }; |
| 1413 | "#; |
| 1414 | let entities = extractor.extract(source, "test.tsx"); |
| 1415 | |
| 1416 | assert_eq!(entities.len(), 2); |
| 1417 | assert!(entities.iter().any(|e| e.name == "Button")); |
| 1418 | assert!(entities.iter().any(|e| e.name == "Card")); |
| 1419 | } |
| 1420 | |
| 1421 | #[test] |
| 1422 | fn test_line_numbers() { |