import XCTest
@testable import FchatiApp

final class WSMessageTests: XCTestCase {
    func testMessageRoundTripPreservesServerFields() throws {
        let message = WSMessage(
            type: "chat.message",
            id: "message-id",
            body: "Hello",
            from: "peer-id",
            fromName: "Alex",
            sentAt: "2026-07-26T18:12:00.123Z"
        )

        let decodedMessage = try JSONDecoder().decode(
            WSMessage.self,
            from: JSONEncoder().encode(message)
        )

        XCTAssertEqual(decodedMessage, message)
    }
}
