Skip to content
Snippets Groups Projects
Commit 804fa0eb authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Update BroadcastMessage model

parent 3cb03493
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!78Update Bindings
......@@ -4,15 +4,18 @@ public struct BroadcastMessage: Equatable {
public init(
roundId: Int,
ephId: [Int],
roundURL: String,
payload: Data
) {
self.roundId = roundId
self.ephId = ephId
self.roundURL = roundURL
self.payload = payload
}
public var roundId: Int
public var ephId: [Int]
public var roundURL: String
public var payload: Data
}
......@@ -20,6 +23,7 @@ extension BroadcastMessage: Codable {
enum CodingKeys: String, CodingKey {
case roundId = "RoundID"
case ephId = "EphID"
case roundURL = "RoundURL"
case payload = "Payload"
}
......
......@@ -6,11 +6,13 @@ final class BroadcastMessageTests: XCTestCase {
func testCoding() throws {
let roundId: Int = 42
let ephId: [Int] = [0, 0, 0, 0, 0, 0, 24, 61]
let roundURL = "https://dashboard.xx.network/rounds/25?xxmessenger=true"
let payloadB64 = "SGVsbG8sIGJyb2FkY2FzdCBmcmllbmRzIQ=="
let jsonString = """
{
"RoundID": \(roundId),
"EphID": [\(ephId.map { "\($0)" }.joined(separator: ", "))],
"RoundURL": "\(roundURL)",
"Payload": "\(payloadB64)"
}
"""
......@@ -20,6 +22,7 @@ final class BroadcastMessageTests: XCTestCase {
XCTAssertNoDifference(model, BroadcastMessage(
roundId: roundId,
ephId: ephId,
roundURL: roundURL,
payload: Data(base64Encoded: payloadB64)!
))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment