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

Update GroupSendReport model

parent 1444ea9a
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!78Update Bindings
......@@ -2,23 +2,27 @@ import Foundation
public struct GroupSendReport: Equatable {
public init(
roundId: UInt64,
rounds: [Int],
roundURL: String,
timestamp: Int64,
messageId: Data
) {
self.roundId = roundId
self.rounds = rounds
self.roundURL = roundURL
self.timestamp = timestamp
self.messageId = messageId
}
public var roundId: UInt64
public var rounds: [Int]
public var roundURL: String
public var timestamp: Int64
public var messageId: Data
}
extension GroupSendReport: Codable {
enum CodingKeys: String, CodingKey {
case roundId = "RoundID"
case rounds = "Rounds"
case roundURL = "RoundURL"
case timestamp = "Timestamp"
case messageId = "MessageID"
}
......
......@@ -4,12 +4,14 @@ import XCTest
final class GroupSendReportTests: XCTestCase {
func testCoding() throws {
let roundId: UInt64 = 123
let timestamp: Int64 = 321
let messageIdB64 = "EB/70R5HYEw5htZ4Hg9ondrn3+cAc/lH2G0mjQMja3w="
let rounds: [Int] = [25, 64]
let roundURL = "https://dashboard.xx.network/rounds/25?xxmessenger=true"
let timestamp: Int64 = 1_662_577_352_813_112_000
let messageIdB64 = "69ug6FA50UT2q6MWH3hne9PkHQ+H9DnEDsBhc0m0Aww="
let jsonString = """
{
"RoundID": \(roundId),
"Rounds": [\(rounds.map { "\($0)" }.joined(separator: ", "))],
"RoundURL": "\(roundURL)",
"Timestamp": \(timestamp),
"MessageID": "\(messageIdB64)"
}
......@@ -18,7 +20,8 @@ final class GroupSendReportTests: XCTestCase {
let model = try GroupSendReport.decode(jsonData)
XCTAssertNoDifference(model, GroupSendReport(
roundId: roundId,
rounds: rounds,
roundURL: roundURL,
timestamp: timestamp,
messageId: Data(base64Encoded: messageIdB64)!
))
......
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