Testing
Running Tests
Run the full test suite:Test Organization
Unit Tests
Embedded alongside the code they test, using#[cfg(test)] modules. Most storage and engine logic has co-located unit tests.
Key test files:
crates/memorose-core/src/storage/tests.rs— comprehensive storage backend tests- Module-level
#[cfg(test)]blocks throughoutengine/,llm/, andgraph/
Integration Tests
Located incrates/memorose-core/tests/integration.rs. These tests exercise the full ingest → retrieve → mark-processed flow.
Test Patterns
Async Tests
All I/O-bound tests usetokio::test:
Temporary Directories
Tests that need storage usetempfile for isolated data directories:
Mock LLM
For tests that involve LLM calls, use mock mode to avoid real API calls:HTTP Mocking
Tests that call external services usewiremock for request interception:
Writing New Tests
Conventions
- Place unit tests in a
#[cfg(test)]module at the bottom of the file being tested - Place integration tests in
crates/memorose-core/tests/ - Use descriptive test names:
test_hybrid_search_with_agent_filter, nottest_search_2 - Clean up any temp resources — prefer
TempDirover manual directory management - Avoid real LLM calls — use mock mode unless you are specifically testing LLM integration