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