MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_tsx_support

Function test_tsx_support

atomic-semantic/src/parser.rs:1471–1492  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1469
1470 #[test]
1471 fn test_tsx_support() {
1472 let mut extractor = TypeScriptExtractor::new_tsx();
1473 let source = r#"
1474export function Button({ onClick, children }: ButtonProps): JSX.Element {
1475 return <button onClick={onClick}>{children}</button>;
1476}
1477
1478export 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() {

Callers

nothing calls this directly

Calls 1

extractMethod · 0.45

Tested by

no test coverage detected