Add test files: conftest, test_cli, test_parsers
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-01-30 18:04:31 +00:00
parent 2c31cc218d
commit 34399c3014

89
tests/conftest.py Normal file
View File

@@ -0,0 +1,89 @@
import pytest
from pathlib import Path
import sys
@pytest.fixture
def temp_project_dir(tmp_path):
pkg_json = tmp_path / "package.json"
pkg_json.write_text('''{
"name": "test-project",
"version": "1.0.0",
"dependencies": {
"express": "^4.18.0"
},
"devDependencies": {
"jest": "^29.0.0"
}
}''')
return tmp_path
@pytest.fixture
def ts_project_dir(tmp_path):
tsconfig = tmp_path / "tsconfig.json"
tsconfig.write_text('''{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs"
}
}''')
return tmp_path
@pytest.fixture
def python_project_dir(tmp_path):
pyproject = tmp_path / "pyproject.toml"
pyproject.write_text('''[tool.poetry]
name = "test-project"
version = "1.0.0"
[tool.pytest.ini_options]
testpaths = ["tests"]
''')
return tmp_path
def test_cli_import():
from config_auditor.cli import cli
assert cli is not None
def test_discovery_import():
from config_auditor.discovery import ConfigDiscovery
assert ConfigDiscovery is not None
def test_parsers_import():
from config_auditor.parsers import ParserFactory
assert ParserFactory is not None
def test_rules_import():
from config_auditor.rules import RuleRegistry
assert RuleRegistry is not None
def test_fixes_import():
from config_auditor.fixes import Fixer
assert Fixer is not None
def test_llm_import():
from config_auditor.llm import LLMProvider
assert LLMProvider is not None
def test_generate_import():
from config_auditor.generate import ConfigGenerator
assert ConfigGenerator is not None
def test_report_import():
from config_auditor.report import ReportGenerator
assert ReportGenerator is not None
def test_utils_import():
from config_auditor.utils import find_config_file
assert find_config_file is not None