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

Function test_tsx_support

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

Source from the content-addressed store, hash-verified

1396
1397 #[test]
1398 fn test_tsx_support() {
1399 let mut extractor = TypeScriptExtractor::new_tsx();
1400 let source = r#"
1401export function Button({ onClick, children }: ButtonProps): JSX.Element {
1402 return <button onClick={onClick}>{children}</button>;
1403}
1404
1405export 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() {

Callers

nothing calls this directly

Calls 1

extractMethod · 0.45

Tested by

no test coverage detected