Skip to content
Snippets Groups Projects
Select Git revision
  • 6a4c64eebb3fe93fe011a4ae7414533ecd80431b
  • main default protected
  • development
  • integration
  • v1.1.5
  • v1.1.4
  • v1.1.3
  • v1.1.2
  • v1.1.1
  • v1.1.0
  • v1.0.0
11 results

GroupSendReportTests.swift

  • GroupSendReportTests.swift 836 B
    import CustomDump
    import XCTest
    @testable import XXClient
    
    final class GroupSendReportTests: XCTestCase {
      func testCoding() throws {
        let roundId: UInt64 = 123
        let timestamp: Int64 = 321
        let messageIdB64 = "EB/70R5HYEw5htZ4Hg9ondrn3+cAc/lH2G0mjQMja3w="
        let jsonString = """
        {
          "RoundID": \(roundId),
          "Timestamp": \(timestamp),
          "MessageID": "\(messageIdB64)"
        }
        """
        let jsonData = jsonString.data(using: .utf8)!
        let model = try GroupSendReport.decode(jsonData)
    
        XCTAssertNoDifference(model, GroupSendReport(
          roundId: roundId,
          timestamp: timestamp,
          messageId: Data(base64Encoded: messageIdB64)!
        ))
    
        let encodedModel = try model.encode()
        let decodedModel = try GroupSendReport.decode(encodedModel)
    
        XCTAssertNoDifference(decodedModel, model)
      }
    }