mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
Add workspace integration tests
- Create tests/workspace_integration.rs with 10 database tests - Export MockEmbeddings for use in integration tests - Tests cover: read/write, append, nested paths, delete, memory ops, daily log, FTS search, hybrid search, list_all, system_prompt Requires: DATABASE_URL=postgres://localhost/near_agent_test Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
b316a7f4f5
commit
383fb21c07
@@ -214,19 +214,20 @@ impl EmbeddingProvider for OpenAiEmbeddings {
|
||||
}
|
||||
|
||||
/// A mock embedding provider for testing.
|
||||
#[cfg(test)]
|
||||
///
|
||||
/// Generates deterministic embeddings based on text hash.
|
||||
/// Useful for unit and integration tests.
|
||||
pub struct MockEmbeddings {
|
||||
dimension: usize,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl MockEmbeddings {
|
||||
/// Create a new mock embeddings provider with the given dimension.
|
||||
pub fn new(dimension: usize) -> Self {
|
||||
Self { dimension }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[async_trait]
|
||||
impl EmbeddingProvider for MockEmbeddings {
|
||||
fn dimension(&self) -> usize {
|
||||
|
||||
@@ -48,7 +48,7 @@ mod search;
|
||||
|
||||
pub use chunker::{ChunkConfig, chunk_document};
|
||||
pub use document::{MemoryChunk, MemoryDocument, WorkspaceEntry, paths};
|
||||
pub use embeddings::{EmbeddingProvider, OpenAiEmbeddings};
|
||||
pub use embeddings::{EmbeddingProvider, MockEmbeddings, OpenAiEmbeddings};
|
||||
pub use repository::Repository;
|
||||
pub use search::{SearchConfig, SearchResult};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user