| 1229 | |
| 1230 | #[test] |
| 1231 | fn test_extract_const() { |
| 1232 | let mut extractor = TypeScriptExtractor::new(); |
| 1233 | let source = r#" |
| 1234 | const MAX_RETRIES = 3; |
| 1235 | const API_URL: string = "https://api.example.com"; |
| 1236 | "#; |
| 1237 | let entities = extractor.extract(source, "test.ts"); |
| 1238 | |
| 1239 | assert_eq!(entities.len(), 2); |
| 1240 | assert_eq!(entities[0].name, "MAX_RETRIES"); |
| 1241 | assert_eq!(entities[0].kind, EntityKind::Const); |
| 1242 | assert_eq!(entities[1].name, "API_URL"); |
| 1243 | assert_eq!(entities[1].kind, EntityKind::Const); |
| 1244 | } |
| 1245 | |
| 1246 | #[test] |
| 1247 | fn test_extract_class() { |