Skip to content

Commit 803df0a

Browse files
committed
tests(chroma0): make sure database is mocked.
1 parent a521bba commit 803df0a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/database/test_chroma0.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,15 @@ async def test_vectorise_no_embeddings(mock_config):
260260
mock_chunker = MagicMock()
261261
mock_chunker.chunk.return_value = [MagicMock(text="chunk1")]
262262
connector.get_embedding = MagicMock(return_value=[])
263-
stats = await connector.vectorise(
264-
os.path.join(mock_config.project_root, "file1"), chunker=mock_chunker
265-
)
266-
assert stats.skipped == 1
263+
with patch(
264+
"vectorcode.database.chroma0.ChromaDB0Connector._create_or_get_collection",
265+
new_callable=AsyncMock,
266+
) as mock_create_collection:
267+
stats = await connector.vectorise(
268+
os.path.join(mock_config.project_root, "file1"), chunker=mock_chunker
269+
)
270+
assert stats.skipped == 1
271+
mock_create_collection.assert_called_once()
267272

268273

269274
@pytest.mark.asyncio

0 commit comments

Comments
 (0)