Skip to main content
MIRA currently has a Python test suite covering the RLM reasoning engine. TypeScript tests for the Electron main process and renderer are scaffolded (Jest is configured in jest.config.json) but not yet written — contributions welcome.

TypeScript tests (Jest)

Configuration

jest.config.json is at the project root. The test environment is node and the pattern matches **/__tests__/**/*.test.ts and **/?(*.)+(spec|test).ts files co-located with source files.

Running (once tests exist)

# Run all tests
npm test

# Run in watch mode
npm run test:watch

# Run with coverage
npm run test:coverage

Mocking strategy

When tests are added, the established mock pattern is:
  • better-sqlite3 — mock with an in-memory database in test setup
  • electron — mocked via src/__mocks__/electron.ts (already present)
  • keytar / safeStorage — mock to avoid OS encryption calls in CI

Python tests (pytest)

The RLM engine (rlm/) has a test suite using pytest.

Running tests

# Activate your virtual environment first
source .venv/bin/activate   # macOS/Linux
# .venv\Scripts\activate    # Windows

# Run all RLM Python tests
pytest rlm/tests/ -v

# Run with coverage
pytest rlm/tests/ --cov=rlm/rlm_context --cov-report=term-missing

Test files

FileCoverage focus
rlm/tests/test_rlm.pyCore RLM iteration control, state machine
rlm/tests/test_integration.pyEnd-to-end loop execution
rlm/tests/test_advanced.pyAdapter correctness, edge cases
rlm/tests/test_e2e.pyFull query-to-response pipelines

Test fixtures

Test documents and sample data are in rlm/tests/.
The NAE engine (resources/nae_context/) does not yet have its own test suite. Its correctness is covered indirectly by the RLM integration tests and manual QA.