Skip to content
Snippets Groups Projects

Bindings models wrapper

Merged Dariusz Rybicki requested to merge feature/bindings-models-wrapper into main
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
+ 30
0
import CustomDump
import XCTest
@testable import ElixxirDAppsSDK
final class FactTests: XCTestCase {
func testCoding() throws {
let jsonString = """
{
"Fact": "Zezima",
"Type": 0
}
"""
let jsonData = jsonString.data(using: .utf8)!
let decoder = JSONDecoder()
decoder.dataDecodingStrategy = .base64
let fact = try decoder.decode(Fact.self, from: jsonData)
XCTAssertNoDifference(fact, Fact(
fact: "Zezima",
type: 0
))
let encoder = JSONEncoder()
encoder.dataEncodingStrategy = .base64
let encodedFact = try encoder.encode(fact)
let decodedFact = try decoder.decode(Fact.self, from: encodedFact)
XCTAssertNoDifference(decodedFact, fact)
}
}
Loading