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

Update SingleUseSendReport model

parent b84fd402
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!78Update Bindings
......@@ -3,15 +3,18 @@ import Foundation
public struct SingleUseSendReport: Equatable {
public init(
rounds: [Int],
roundURL: String,
ephId: Int64,
receptionId: Data
) {
self.rounds = rounds
self.roundURL = roundURL
self.ephId = ephId
self.receptionId = receptionId
}
public var rounds: [Int]
public var roundURL: String
public var ephId: Int64
public var receptionId: Data
}
......@@ -19,6 +22,7 @@ public struct SingleUseSendReport: Equatable {
extension SingleUseSendReport: Codable {
enum CodingKeys: String, CodingKey {
case rounds = "Rounds"
case roundURL = "RoundURL"
case ephId = "EphID"
case receptionId = "ReceptionID"
}
......
......@@ -5,11 +5,13 @@ import XCTest
final class SingleUseSendReportTests: XCTestCase {
func testCoding() throws {
let rounds: [Int] = [1, 5, 9]
let roundURL = "https://dashboard.xx.network/rounds/25?xxmessenger=true"
let ephId: Int64 = 1_655_533
let receptionIdB64 = "emV6aW1hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD"
let jsonString = """
{
"Rounds": [\(rounds.map { "\($0)" }.joined(separator: ", "))],
"RoundURL": "\(roundURL)",
"EphID": \(ephId),
"ReceptionID": "\(receptionIdB64)"
}
......@@ -19,6 +21,7 @@ final class SingleUseSendReportTests: XCTestCase {
XCTAssertNoDifference(model, SingleUseSendReport(
rounds: rounds,
roundURL: roundURL,
ephId: ephId,
receptionId: Data(base64Encoded: receptionIdB64)!
))
......
......@@ -38,7 +38,7 @@ final class MessengerSearchUsersTests: XCTestCase {
.unimplemented("contact-2".data(using: .utf8)!),
.unimplemented("contact-3".data(using: .utf8)!),
]))
return SingleUseSendReport(rounds: [], ephId: 0, receptionId: Data())
return SingleUseSendReport(rounds: [], roundURL: "", ephId: 0, receptionId: Data())
}
let search: MessengerSearchUsers = .live(env)
......@@ -128,7 +128,7 @@ final class MessengerSearchUsersTests: XCTestCase {
env.getSingleUseParams.run = { Data() }
env.searchUD.run = { _, _, _, _, callback in
callback.handle(.failure(error as NSError))
return SingleUseSendReport(rounds: [], ephId: 0, receptionId: Data())
return SingleUseSendReport(rounds: [], roundURL: "", ephId: 0, receptionId: Data())
}
let search: MessengerSearchUsers = .live(env)
......
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