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

Rename ContactFact model to Fact

parent 58bbf5f7
No related branches found
No related tags found
1 merge request!3Bindings models wrapper
public struct ContactFact: Equatable { public struct Fact: Equatable {
public init( public init(
fact: String, fact: String,
type: Int type: Int
...@@ -11,7 +11,7 @@ public struct ContactFact: Equatable { ...@@ -11,7 +11,7 @@ public struct ContactFact: Equatable {
public var type: Int public var type: Int
} }
extension ContactFact: Codable { extension Fact: Codable {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case fact = "Fact" case fact = "Fact"
case type = "Type" case type = "Type"
......
...@@ -13,9 +13,9 @@ final class ContactFactTests: XCTestCase { ...@@ -13,9 +13,9 @@ final class ContactFactTests: XCTestCase {
let jsonData = jsonString.data(using: .utf8)! let jsonData = jsonString.data(using: .utf8)!
let decoder = JSONDecoder() let decoder = JSONDecoder()
decoder.dataDecodingStrategy = .base64 decoder.dataDecodingStrategy = .base64
let fact = try decoder.decode(ContactFact.self, from: jsonData) let fact = try decoder.decode(Fact.self, from: jsonData)
XCTAssertNoDifference(fact, ContactFact( XCTAssertNoDifference(fact, Fact(
fact: "Zezima", fact: "Zezima",
type: 0 type: 0
)) ))
...@@ -23,7 +23,7 @@ final class ContactFactTests: XCTestCase { ...@@ -23,7 +23,7 @@ final class ContactFactTests: XCTestCase {
let encoder = JSONEncoder() let encoder = JSONEncoder()
encoder.dataEncodingStrategy = .base64 encoder.dataEncodingStrategy = .base64
let encodedFact = try encoder.encode(fact) let encodedFact = try encoder.encode(fact)
let decodedFact = try decoder.decode(ContactFact.self, from: encodedFact) let decodedFact = try decoder.decode(Fact.self, from: encodedFact)
XCTAssertNoDifference(decodedFact, fact) XCTAssertNoDifference(decodedFact, fact)
} }
......
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