This commit was merged in pull request #193.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Tests for SQLite-backed chat persistence (issue #46)."""
|
||||
|
||||
from dashboard.store import Message, MessageLog
|
||||
import infrastructure.chat_store as _chat_store
|
||||
|
||||
|
||||
def test_persistence_across_instances(tmp_path):
|
||||
@@ -24,10 +25,8 @@ def test_persistence_across_instances(tmp_path):
|
||||
|
||||
def test_retention_policy(tmp_path):
|
||||
"""Oldest messages are pruned when count exceeds MAX_MESSAGES."""
|
||||
import dashboard.store as store_mod
|
||||
|
||||
original_max = store_mod.MAX_MESSAGES
|
||||
store_mod.MAX_MESSAGES = 5 # Small limit for testing
|
||||
original_max = _chat_store.MAX_MESSAGES
|
||||
_chat_store.MAX_MESSAGES = 5 # Small limit for testing
|
||||
|
||||
try:
|
||||
db = tmp_path / "chat.db"
|
||||
@@ -42,7 +41,7 @@ def test_retention_policy(tmp_path):
|
||||
assert msgs[-1].content == "msg-7"
|
||||
log.close()
|
||||
finally:
|
||||
store_mod.MAX_MESSAGES = original_max
|
||||
_chat_store.MAX_MESSAGES = original_max
|
||||
|
||||
|
||||
def test_clear_removes_all(tmp_path):
|
||||
|
||||
Reference in New Issue
Block a user