This commit is contained in:
25
tests/test_ai_insight_embedding_bridge.py
Normal file
25
tests/test_ai_insight_embedding_bridge.py
Normal file
@@ -0,0 +1,25 @@
|
||||
def test_enqueue_insight_embedding_builds_queue_payload(monkeypatch):
|
||||
import services.openclaw_learning_service as learning
|
||||
|
||||
calls = []
|
||||
monkeypatch.setattr(
|
||||
learning,
|
||||
"_enqueue_embedding",
|
||||
lambda table, target_id, text: calls.append((table, target_id, text)) or True,
|
||||
)
|
||||
|
||||
assert learning.enqueue_insight_embedding(42, "agent_action", "hello", "2026-04-29") is True
|
||||
assert calls == [("ai_insights", 42, "agent_action (2026-04-29): hello")]
|
||||
|
||||
|
||||
def test_enqueue_insight_embedding_rejects_missing_content(monkeypatch):
|
||||
import services.openclaw_learning_service as learning
|
||||
|
||||
monkeypatch.setattr(
|
||||
learning,
|
||||
"_enqueue_embedding",
|
||||
lambda *args, **kwargs: (_ for _ in ()).throw(AssertionError("should not enqueue")),
|
||||
)
|
||||
|
||||
assert learning.enqueue_insight_embedding(42, "agent_action", "") is False
|
||||
assert learning.enqueue_insight_embedding(None, "agent_action", "hello") is False
|
||||
Reference in New Issue
Block a user