mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-27 04:59:02 +00:00
* core: add chat_migrate_init_queue FFI export * bots: fix BadgeServiceErrorCode API type * nodejs: pass required command fields * nodejs: fix migration error types * nodejs: install libsimplex from SIMPLEX_LIBS_DIR * nodejs: add queue size option * nodejs: regenerate docs * python: add queue size option * bots: pass incognito in APIConnect * nodejs: accept documented success responses * python: accept documented success responses * nodejs: dispatch each bot message once * nodejs: fix startChat events loop lifecycle * nodejs, python: parse multi-line bot commands * nodejs: fix file buffer handling in addon * nodejs: keep events loop when chat stop fails * python: fix send_and_wait race, load lib off loop * python: make queue size export optional * nodejs: receive events on a dedicated thread * nodejs: release haskell thread after receive * python: receive on a dedicated thread per chat * python: test receive shutdown order * nodejs: one receive thread per chat controller * nodejs: harden receiver shutdown and tests * nodejs: stop chat before closing store * python: stop chat before closing store * nodejs, python: harden close regression and retry * python: free results with ucrt on windows * nodejs: enable c++ exceptions on mac and windows
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
"""Sanity checks on auto-generated wire types — catches generator regressions."""
|
|
|
|
import typing
|
|
|
|
from simplex_chat.types import CC, CR, CEvt, T
|
|
|
|
|
|
def test_types_module_imports():
|
|
"""Every generated module imports cleanly with no SyntaxError."""
|
|
assert T is not None and CC is not None and CR is not None and CEvt is not None
|
|
|
|
|
|
def test_chat_type_is_literal_enum():
|
|
"""ChatType should be a Literal of expected member set."""
|
|
args = typing.get_args(T.ChatType)
|
|
assert "direct" in args
|
|
assert "group" in args
|
|
assert "local" in args
|
|
|
|
|
|
def test_known_command_has_cmd_string():
|
|
s = CC.APICreateMyAddress_cmd_string({"userId": 1})
|
|
assert s == "/_address 1"
|
|
|
|
|
|
def test_chat_response_tag_alias_present():
|
|
"""ChatResponse_Tag union of literals exists."""
|
|
assert hasattr(CR, "ChatResponse_Tag")
|
|
|
|
|
|
def test_chat_event_tag_alias_present():
|
|
"""ChatEvent_Tag exists; covers the on_event Literal annotation."""
|
|
assert hasattr(CEvt, "ChatEvent_Tag")
|
|
args = typing.get_args(CEvt.ChatEvent_Tag)
|
|
assert "newChatItems" in args
|
|
|
|
|
|
def test_chat_ref_cmd_string_direct():
|
|
"""Sanity check the codegen fix for ChatRef-bearing commands."""
|
|
assert T.ChatRef_cmd_string({"chatType": "direct", "chatId": 7}) == "@7"
|
|
assert T.ChatRef_cmd_string({"chatType": "group", "chatId": 42}) == "#42"
|
|
|
|
|
|
def test_api_connect_cmd_string_renders_incognito():
|
|
link = {"connFullLink": "L"}
|
|
assert CC.APIConnect_cmd_string({"userId": 1, "incognito": True, "preparedLink_": link}) == "/_connect 1 incognito=on L"
|
|
assert CC.APIConnect_cmd_string({"userId": 1, "incognito": False, "preparedLink_": link}) == "/_connect 1 L"
|