Files
odysseus/tests/test_new_chat_model_preference.py
T
pewdiepie-archdaemon 038bdd85ec Stabilize local dev merge
Align regression tests with the current Odysseus behavior after merging origin/dev into local main.

- keep phone/name-only contacts valid and cover null email without crashes

- pin explicit web-search false form submission in chat.js

- update Cookbook dependency/download completion tests for combined live + persisted output

- expose SGLang OS package repair hints from backend diagnosis

- treat MLX and MLX-community repos as servable on Apple Metal while keeping CUDA behavior unchanged

- keep desktop new-chat coverage on the shared preferred-model helper

- remove a hardcoded crop overlay portal z-index literal

- include the local agent-loop cleanup that removes the old manage_notes reminder repair shim

Verified with: docker run --rm -v /home/pewds/odysseus-cookbook-fresh:/app -w /app odysseus-cookbook-fresh-odysseus python3 -m pytest -q (4515 passed, 4 skipped).
2026-07-07 01:15:20 +00:00

51 lines
1.7 KiB
Python

from pathlib import Path
APP_JS = Path("static/app.js")
def _slice(source, start_marker, end_marker):
start = source.index(start_marker)
end = source.index(end_marker, start)
return source[start:end]
def test_new_chat_prefers_pending_and_current_model_before_default():
source = APP_JS.read_text(encoding="utf-8")
helper = _slice(
source,
"async function _createDirectChatFromPreferredModel()",
"// ============================================",
)
default_pos = helper.index("const dc = await _refreshDefaultChat();")
assert helper.index("sessionModule.getPendingChat") < default_pos
assert helper.index("current.endpoint_url") < default_pos
assert default_pos < helper.index("const withModel = sessions.filter")
def test_desktop_new_chat_actions_use_shared_preference_helper():
source = APP_JS.read_text(encoding="utf-8")
shared_handler = _slice(
source,
"async function _handleNewChatAction",
"// New session button on icon rail",
)
rail_handler = _slice(
source,
"// New session button on icon rail",
"// Mobile new chat button",
)
brand_handler = _slice(
source,
"// Logo click \u2192 new chat",
"const sidebarNewChatBtn = el('sidebar-new-chat-btn');",
)
assert "if (preferModel && await _createDirectChatFromPreferredModel()) return;" in shared_handler
assert "await _handleNewChatAction();" in rail_handler
assert "await _handleNewChatAction();" in brand_handler
assert "const dc = await _refreshDefaultChat();" not in rail_handler
assert "const dc = await _refreshDefaultChat();" not in brand_handler