chat_proto/nim/tests/test_encoding.nim

14 lines
408 B
Nim
Raw Normal View History

2025-06-30 17:52:54 -07:00
import unittest
2025-07-02 20:10:34 -07:00
import chat_proto
2025-06-30 17:52:54 -07:00
suite "Type Encoding Tests":
test "HistoryEntry roundtrip":
2025-07-02 20:10:34 -07:00
let x = chat_proto.HistoryEntry(message_id: "12345", retrieval_hint: @[1'u8, 2, 3, 255])
2025-06-30 17:52:54 -07:00
let encoded = Protobuf.encode(x)
let decoded = Protobuf.decode(encoded, HistoryEntry)
check x.message_id == decoded.message_id
check x.retrieval_hint == decoded.retrieval_hint
check x == decoded