from kbqa.chat.sse import encode_event, encode_ping


def test_sse_encodes_single_line_utf8_json() -> None:
    assert encode_event("token", {"content": "知识"}) == (
        'event: token\ndata: {"content":"知识"}\n\n'.encode()
    )
    assert encode_ping() == b": ping\n\n"
