Files
MajoorWaldi-ComfyUI-Majoor-…/tests
Ewald ba272531ef feat(viewer): enhance player bar manager with active video asset tracking
- Added `_activeVideoAssetId` to track the currently active video asset in `playerBarManager.js`.
- Updated sync logic to ensure controls are remounted only when the asset changes.
- Improved handling of video synchronization and FPS settings.

feat(sideBySide): sanitize prompts for display

- Introduced `sanitizePromptForDisplay` to clean up prompts before displaying.
- Updated `_extractGridGenInfo` to use the new sanitization function for prompts.

feat(sidebar): enhance workflow section with size options and stats

- Added size options for the minimap in `SidebarWorkflowSection.vue`.
- Implemented workflow statistics display, including nodes, links, and groups.
- Persisted size and label settings for the minimap.

fix(generation): prevent filepath prompts from being displayed

- Updated prompt handling in `generationSectionState.js` to sanitize prompts.
- Added tests to ensure filepath-like prompts do not affect UI behavior.

feat(gridLoader): implement adaptive paging for grid loader

- Introduced `getAdaptivePageLimit` to dynamically adjust page size based on empty append batches.
- Updated `useGridLoader` to utilize adaptive paging logic.

feat(vectorIndexer): add regex for path-like prompts

- Implemented `_looks_like_path_prompt` to identify and handle path-like prompts in `vector_indexer.py`.

test: add unit tests for prompt sanitization and grid loader

- Created tests for prompt sanitization logic in `generation_prompt_sanitization.vitest.mjs`.
- Added tests for adaptive paging behavior in `grid_loader_adaptive_paging.vitest.mjs`.
- Implemented tests for sidebar workflow section functionality in `sidebar_workflow_section.vitest.mjs`.
- Added tests for player bar FPS synchronization in `viewer_player_bar_fps_sync.vitest.mjs`.

docs: update user guide and add privacy/offline documentation

- Added a privacy and offline usage guide in `PRIVACY_OFFLINE.md`.
- Updated user guide to reference new privacy documentation.
2026-04-07 10:35:43 +02:00
..
2026-04-05 20:37:19 +02:00

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
  • 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 schema
  • temp_dir - Temporary directory for test files
  • mock_exiftool - Mocked ExifTool adapter

Resources


Last updated: April 5, 2026