Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A quick fix to our social object Post unit test #54

Merged
merged 3 commits into from
Dec 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions DigiMeSDK/Repository/Classes/Objects/Social/Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,25 @@ public class Post: NSObject, BaseObjectDecodable {
public let likeCount: Int
public let links: [Link]?
public let longitude: Double
public let originalPostIdentifier: String?
public var originalPostIdentifier: String? {
guard let originalPostId = originalPostIdentifierRaw else {
return nil
}

return String(describing: originalPostId)
}
public let originalPostUrl: String
public let personIdentifier: String
public let personFileUrl: String
public let personFullname: String
public let personUsername: String
public let postIdentifier: String
public var postReplyCount: String? {
return String(describing: postReplyCountRaw)
guard let replyCount = postReplyCountRaw else {
return nil
}

return String(describing: replyCount)
}

public let postUrl: String
Expand All @@ -88,7 +98,11 @@ public class Post: NSObject, BaseObjectDecodable {
public let postEntityIdentifier: String?
public let personFileRelativePath: String?
public var originalCrossPostIdentifier: String? {
return String(describing: originalCrossPostIdentifierRaw)
guard let originalCrossPostId = originalCrossPostIdentifierRaw else {
return nil
}

return String(describing: originalCrossPostId)
}

// MARK: - Objective-C Representations of non-optional primitives
Expand All @@ -109,6 +123,7 @@ public class Post: NSObject, BaseObjectDecodable {
private let typeRaw: Int
private let postReplyCountRaw: AnyJSONType?
private let originalCrossPostIdentifierRaw: AnyJSONType?
private let originalPostIdentifierRaw: AnyJSONType?

// MARK: - Decodable
enum CodingKeys: String, CodingKey {
Expand All @@ -129,7 +144,7 @@ public class Post: NSObject, BaseObjectDecodable {
case links = "links"
case longitude = "longitude"
case originalCrossPostIdentifierRaw = "originalcrosspostid"
case originalPostIdentifier = "originalpostid"
case originalPostIdentifierRaw = "originalpostid"
case originalPostUrl = "originalposturl"
case personIdentifier = "personentityid"
case personFileUrl = "personfileurl"
Expand Down