# Conflicts: # dist/chunks/FloatingViewer-AB1oLZ0d.js # dist/chunks/FloatingViewer-BVmALIs3.js # dist/chunks/FloatingViewer-Cg2hGEZM.js # dist/chunks/LiveStreamTracker-0EQGV-lK.js # dist/chunks/LiveStreamTracker-BUT5H4M5.js # dist/chunks/LiveStreamTracker-DdMfL0ro.js # dist/chunks/SidebarWorkflowSection-B4wvtrtQ.js # dist/chunks/SidebarWorkflowSection-B_P-QZwl.js # dist/chunks/SidebarWorkflowSection-DckvqBNY.js # dist/chunks/TagsEditor-B8xpRa5e.js # dist/chunks/TagsEditor-BHGoWuSC.js # dist/chunks/TagsEditor-cUM_tRt-.js # dist/chunks/Viewer-DDNDTRcP.js # dist/chunks/Viewer-Dzb5KE6D.js # dist/chunks/Viewer-GH30s1No.js # dist/chunks/ViewerPortal-BAh1499M.js # dist/chunks/ViewerPortal-C-GBMubk.js # dist/chunks/ViewerPortal-DvYVQ32S.js # dist/chunks/floatingViewerManager-5-IYujSt.js # dist/chunks/floatingViewerManager-BVG4XDLW.js # dist/chunks/floatingViewerManager-Bnd82Qrd.js # dist/chunks/genInfo-Bq-kF66o.js # dist/chunks/genInfo-CV-v139t.js # dist/chunks/genInfo-CwY4j1FN.js # dist/chunks/mjr-primevue-C955bvXT.js # dist/chunks/mjr-primevue-DtKnnCVn.js # dist/chunks/mjr-primevue-n1rsQYJg.js # dist/chunks/mjr-vue-vendor-BU1tBlvz.js # dist/chunks/mjr-vue-vendor-CF0zsqr1.js # dist/chunks/mjr-vue-vendor-D2GeV7Qd.js # dist/chunks/openMajoorSettings-CHrLP8DR.js # dist/chunks/openMajoorSettings-DU4OegtI.js # dist/chunks/openMajoorSettings-JYq392b-.js # dist/chunks/viewerOpenRequest-C4hEgmOj.js # dist/chunks/viewerOpenRequest-CzyrZA71.js # dist/chunks/viewerOpenRequest-DQQY02Vk.js # dist/chunks/viewerRuntimeHosts-CIiyEfr6.js # dist/chunks/viewerRuntimeHosts-CuR8T4j6.js # dist/chunks/viewerRuntimeHosts-DC1iA_jY.js # dist/entry.js # mjr_am_backend/features/index/vector_service.py # mjr_am_backend/routes/core/request_json.py # mjr_am_backend/routes/core/security_proxies.py # mjr_am_backend/routes/core/security_tokens.py # mjr_am_shared/version.py Co-authored-by: MajoorWaldi <129623145+MajoorWaldi@users.noreply.github.com>
Tests - Majoor Assets Manager
Test suite for ComfyUI-Majoor-AssetsManager.
Test Structure
tests/
├── conftest.py # Pytest fixtures & shared setup
├── README.md # Test documentation
├── run_tests_all.bat # Windows full-suite runner
├── __init__.py
├── assets/ # Asset fixtures and media samples
├── compat/ # Backward-compatibility coverage
├── config/ # Configuration tests and runner
├── core/ # Core route and path helpers
├── database/ # Schema and SQLite behavior
├── features/ # Main feature, service, and route coverage
├── metadata/ # Metadata extraction coverage
├── parser/ # Parser-focused regression samples
├── quality/ # Quality-gate tests
├── rating_tags/ # Ratings, tags, and sync behavior
├── regressions/ # Targeted regression coverage
├── routes/ # Route-level scenarios
└── security/ # Security-specific tests
Running Tests
All tests (Windows)
Double-click run_tests.bat in the project root, or:
cd ComfyUI/custom_nodes/ComfyUI-Majoor-AssetsManager
python -m pytest tests/ -q
Single test file
python -m pytest tests/core/test_routes.py -v
Single folder
python -m pytest tests/metadata/ -v
Single test function
python -m pytest tests/core/test_routes.py::test_routes -v
With coverage
pytest tests/ --cov=mjr_am_backend --cov=mjr_am_shared --cov-report=html
Test Categories
core/ - Core functionality
- Result pattern (Ok/Err)
- IndexService scan/search
- FTS5 full-text search
- API route handlers
- End-to-end integration
metadata/ - Metadata extraction
- ExifTool/FFprobe extraction
- PNG/WEBP/video generation info
- Workflow JSON parsing
- Quality score calculations
rating_tags/ - Ratings & tags
- Rating/tag extraction from files
- OS file sync
- Import operations
assets/ - Assets & search
- Batch operations
- Delete operations
- FTS5 search
- Staging deduplication
database/ - Database & schema
- Schema migration/healing
- SQLite query patterns
- Geninfo self-healing
config/ - Config & security
- CSRF protection
- Origin validation
- Rate limiting
- Path traversal prevention
- Settings persistence
features/ - Feature tests
- Collections CRUD
- Multi-file ZIP export
- Date histogram
- Viewer grid masks
regressions/ - Regression tests
- Audit issue fixes
- Scan batching regressions
- Logging system
Writing Tests
Test isolation
Each test should be independent using in-memory databases:
@pytest.mark.asyncio
async def test_example():
db = Sqlite(":memory:")
await migrate_schema(db)
# ... test logic
await db.aclose()
Result pattern
Always verify the Result pattern:
def test_service_result():
result = service.do_something()
assert isinstance(result, Result)
if result.ok:
assert result.data is not None
else:
assert result.error is not None
Mock external tools
Don't depend on ExifTool/FFprobe availability:
class MockExifTool:
def is_available(self):
return False
Fixtures
Common fixtures are defined in conftest.py:
test_db- In-memory SQLite with schematemp_dir- Temporary directory for test filesmock_exiftool- Mocked ExifTool adapter
Resources
Last updated: April 5, 2026