Skip to content

Commit c204ec0

Browse files
committed
fix: remove unused imports, add .d.ts resolution test
- Removed unused tempfile and os imports (tests use pytest tmp_path) - Added test_d_ts_files_are_discovered: verifies import './config.js' resolves to config.d.ts when no .ts file exists
1 parent 0fa6f6d commit c204ec0

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

backend/tests/test_dependency_analyzer.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Tests for DependencyAnalyzer -- TypeScript parsing, import resolution, include_paths
33
"""
44
import pytest
5-
import tempfile
6-
import os
75
from pathlib import Path
86

97

@@ -201,6 +199,19 @@ def test_relative_imports_resolve(self, analyzer, ts_repo):
201199
# Should resolve at least some internal deps
202200
assert len(edges_from_option) > 0
203201

202+
def test_d_ts_files_are_discovered(self, analyzer, tmp_path):
203+
"""Imports resolving to .d.ts files should produce edges"""
204+
src = tmp_path / "src"
205+
src.mkdir()
206+
(src / "index.ts").write_text('import { Config } from "./config.js"')
207+
(src / "config.d.ts").write_text('export interface Config { port: number }')
208+
209+
graph = analyzer.build_dependency_graph(str(tmp_path))
210+
file_paths = set(graph['dependencies'].keys())
211+
assert 'src/config.d.ts' in file_paths
212+
targets = [e['target'] for e in graph['edges'] if e['source'] == 'src/index.ts']
213+
assert 'src/config.d.ts' in targets
214+
204215

205216
class TestIncludePaths:
206217
"""Verify include_paths filtering works correctly"""

0 commit comments

Comments
 (0)