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

Function test_tsx_support

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

Source from the content-addressed store, hash-verified

1441
1442 #[test]
1443 fn test_tsx_support() {
1444 let mut extractor = TypeScriptExtractor::new_tsx();
1445 let source = r#"
1446export function Button({ onClick, children }: ButtonProps): JSX.Element {
1447 return <button onClick={onClick}>{children}</button>;
1448}
1449
1450export 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() {

Callers

nothing calls this directly

Calls 1

extractMethod · 0.45

Tested by

no test coverage detected