Files
odysseus/tests/test_queued_message_merge_static.py
T
64b457dc0a fix(tests): read static sources as UTF-8 in the static assertion tests (#6850)
On native Windows the default text encoding is the ANSI code page
(cp1252 on en/pt systems), so the module-level read_text() calls in
eight static tests fail at collection with UnicodeDecodeError on bytes
0x81/0x90 that appear in static/js/chat.js, chatRenderer.js, app.js,
index.html and src/visual_report.py. Pass encoding="utf-8" like the
other 700+ tests in the suite already do.

Found by running the suite natively on Windows 11 (Python 3.11).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Alexandre Teixeira <general@alexandreteixeira.dev>
2026-11-01 01:26:11 +00:00

24 lines
969 B
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
CHAT = (ROOT / "static/js/chat.js").read_text(encoding="utf-8")
def test_queued_stack_is_consumed_as_one_ordered_message():
assert "function _consumeQueuedRequestStack()" in CHAT
assert "_queuedAgentRequests[i].sessionId === sid" in CHAT
assert ".join('\\n\\n')" in CHAT
def test_automatic_drain_sends_the_combined_stack_once():
drain = CHAT[CHAT.index("function _drainQueuedAgentRequests()") : CHAT.index("/**\n * Handle chat form submission")]
assert "const next = _consumeQueuedRequestStack();" in drain
assert "_removeQueuedRequest(next.id)" not in drain
assert "_setComposerAndSend(next.message);" in drain
def test_clicking_a_queued_bubble_promotes_the_whole_stack():
promote = CHAT[CHAT.index("function _promoteQueuedRequest(id)") : CHAT.index("function _queueAgentRequest(message)")]
assert "const item = _consumeQueuedRequestStack();" in promote