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

SPM Prep - Convert "WordPress JSON date" logic from Objective-C to Swift #758

Merged
merged 13 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ _None._

### Breaking Changes

_None._
- Reworked the `NSDate` RFC3339 / WordPress.com JSON conversions API [#759]

### New Features

Expand Down
2 changes: 1 addition & 1 deletion WordPressKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pod::Spec.new do |s|
s.name = 'WordPressKit'
s.version = '14.1.0'
s.version = '15.0.0-beta.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we make version change in a dedicated PR along side with moving changelog content. Do you intend to make a release once this PR is merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. I just wanted to put a line in the sand for the breaking change.


s.summary = 'WordPressKit offers a clean and simple WordPress.com and WordPress.org API.'
s.description = <<-DESC
Expand Down
32 changes: 24 additions & 8 deletions WordPressKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
3F758FD324F6C68200BBA2FC /* AnnouncementServiceRemote.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F758FD224F6C68200BBA2FC /* AnnouncementServiceRemote.swift */; };
3F8308A729EE683500354497 /* ActivityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F8308A629EE683500354497 /* ActivityTests.swift */; };
3FB8642C2888089F003A86BE /* BuildkiteTestCollector in Frameworks */ = {isa = PBXBuildFile; productRef = 3FB8642B2888089F003A86BE /* BuildkiteTestCollector */; };
3FFCC0412BA995290051D229 /* Date+WordPressComTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFCC0402BA995290051D229 /* Date+WordPressComTests.swift */; };
3FFCC0472BAA6EF40051D229 /* NSDate+WordPressCom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFCC0462BAA6EF40051D229 /* NSDate+WordPressCom.swift */; };
3FFCC0492BAB98130051D229 /* DateFormatter+WordPressCom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFCC0482BAB98130051D229 /* DateFormatter+WordPressCom.swift */; };
3FFCC04B2BABA5220051D229 /* DateFormatter+WordPressComTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFCC04A2BABA5220051D229 /* DateFormatter+WordPressComTests.swift */; };
3FFCC04D2BABA6980051D229 /* NSDate+WordPressComTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFCC04C2BABA6980051D229 /* NSDate+WordPressComTests.swift */; };
3FFCC04F2BABA6E60051D229 /* Date+WordPressCom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FFCC04E2BABA6E60051D229 /* Date+WordPressCom.swift */; };
40247DFA2120D8E100AE1C3C /* AutomatedTransferService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40247DF92120D8E100AE1C3C /* AutomatedTransferService.swift */; };
40247DFC2120E69600AE1C3C /* AutomatedTransferStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40247DFB2120E69600AE1C3C /* AutomatedTransferStatus.swift */; };
404057C5221B30400060250C /* StatsSearchTermTimeIntervalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 404057C4221B30400060250C /* StatsSearchTermTimeIntervalData.swift */; };
Expand Down Expand Up @@ -485,8 +491,6 @@
93BD27711EE737A8002BB00B /* ServiceRemoteWordPressXMLRPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BD276D1EE737A8002BB00B /* ServiceRemoteWordPressXMLRPC.h */; settings = {ATTRIBUTES = (Public, ); }; };
93BD27721EE737A9002BB00B /* ServiceRemoteWordPressXMLRPC.m in Sources */ = {isa = PBXBuildFile; fileRef = 93BD276E1EE737A8002BB00B /* ServiceRemoteWordPressXMLRPC.m */; };
93BD277C1EE73944002BB00B /* HTTPAuthenticationAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BD27741EE73944002BB00B /* HTTPAuthenticationAlertController.swift */; };
93BD277D1EE73944002BB00B /* NSDate+WordPressJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 93BD27751EE73944002BB00B /* NSDate+WordPressJSON.h */; settings = {ATTRIBUTES = (Public, ); }; };
93BD277E1EE73944002BB00B /* NSDate+WordPressJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 93BD27761EE73944002BB00B /* NSDate+WordPressJSON.m */; };
93BD277F1EE73944002BB00B /* WordPressComOAuthClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BD27771EE73944002BB00B /* WordPressComOAuthClient.swift */; };
93BD27801EE73944002BB00B /* WordPressComRestApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BD27781EE73944002BB00B /* WordPressComRestApi.swift */; };
93BD27811EE73944002BB00B /* WordPressOrgXMLRPCApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BD27791EE73944002BB00B /* WordPressOrgXMLRPCApi.swift */; };
Expand Down Expand Up @@ -798,6 +802,12 @@
3F758FD224F6C68200BBA2FC /* AnnouncementServiceRemote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnnouncementServiceRemote.swift; sourceTree = "<group>"; };
3F8308A629EE683500354497 /* ActivityTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityTests.swift; sourceTree = "<group>"; };
3FB8642D288813E9003A86BE /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = "<group>"; };
3FFCC0402BA995290051D229 /* Date+WordPressComTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+WordPressComTests.swift"; sourceTree = "<group>"; };
3FFCC0462BAA6EF40051D229 /* NSDate+WordPressCom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDate+WordPressCom.swift"; sourceTree = "<group>"; };
3FFCC0482BAB98130051D229 /* DateFormatter+WordPressCom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+WordPressCom.swift"; sourceTree = "<group>"; };
3FFCC04A2BABA5220051D229 /* DateFormatter+WordPressComTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+WordPressComTests.swift"; sourceTree = "<group>"; };
3FFCC04C2BABA6980051D229 /* NSDate+WordPressComTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDate+WordPressComTests.swift"; sourceTree = "<group>"; };
3FFCC04E2BABA6E60051D229 /* Date+WordPressCom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+WordPressCom.swift"; sourceTree = "<group>"; };
40247DF92120D8E100AE1C3C /* AutomatedTransferService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutomatedTransferService.swift; sourceTree = "<group>"; };
40247DFB2120E69600AE1C3C /* AutomatedTransferStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutomatedTransferStatus.swift; sourceTree = "<group>"; };
404057C4221B30400060250C /* StatsSearchTermTimeIntervalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatsSearchTermTimeIntervalData.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1218,8 +1228,6 @@
93BD276D1EE737A8002BB00B /* ServiceRemoteWordPressXMLRPC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceRemoteWordPressXMLRPC.h; sourceTree = "<group>"; };
93BD276E1EE737A8002BB00B /* ServiceRemoteWordPressXMLRPC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ServiceRemoteWordPressXMLRPC.m; sourceTree = "<group>"; };
93BD27741EE73944002BB00B /* HTTPAuthenticationAlertController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTTPAuthenticationAlertController.swift; sourceTree = "<group>"; };
93BD27751EE73944002BB00B /* NSDate+WordPressJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+WordPressJSON.h"; sourceTree = "<group>"; };
93BD27761EE73944002BB00B /* NSDate+WordPressJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+WordPressJSON.m"; sourceTree = "<group>"; };
93BD27771EE73944002BB00B /* WordPressComOAuthClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordPressComOAuthClient.swift; sourceTree = "<group>"; };
93BD27781EE73944002BB00B /* WordPressComRestApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordPressComRestApi.swift; sourceTree = "<group>"; };
93BD27791EE73944002BB00B /* WordPressOrgXMLRPCApi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WordPressOrgXMLRPCApi.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1904,6 +1912,9 @@
FFA4D4A82423B10A00BF5180 /* WordPressOrgRestApiTests.swift */,
74B335DB1F06F4180053A184 /* WordPressOrgXMLRPCApiTests.swift */,
740B23D51F17F7C100067A2A /* XMLRPCTestable.swift */,
3FFCC0402BA995290051D229 /* Date+WordPressComTests.swift */,
3FFCC04C2BABA6980051D229 /* NSDate+WordPressComTests.swift */,
3FFCC04A2BABA5220051D229 /* DateFormatter+WordPressComTests.swift */,
);
name = Tests;
sourceTree = "<group>";
Expand Down Expand Up @@ -2518,8 +2529,9 @@
4A05E7952B2FCB6400C25E3B /* NonceRetrieval.swift */,
4A05E7992B2FDC3200C25E3B /* WordPressOrgRestApi.swift */,
93BD27741EE73944002BB00B /* HTTPAuthenticationAlertController.swift */,
93BD27751EE73944002BB00B /* NSDate+WordPressJSON.h */,
93BD27761EE73944002BB00B /* NSDate+WordPressJSON.m */,
3FFCC0462BAA6EF40051D229 /* NSDate+WordPressCom.swift */,
3FFCC04E2BABA6E60051D229 /* Date+WordPressCom.swift */,
3FFCC0482BAB98130051D229 /* DateFormatter+WordPressCom.swift */,
93BD27771EE73944002BB00B /* WordPressComOAuthClient.swift */,
93BD27781EE73944002BB00B /* WordPressComRestApi.swift */,
93BD27791EE73944002BB00B /* WordPressOrgXMLRPCApi.swift */,
Expand Down Expand Up @@ -2797,7 +2809,6 @@
93BD273C1EE73282002BB00B /* AccountServiceRemoteREST.h in Headers */,
93BD27711EE737A8002BB00B /* ServiceRemoteWordPressXMLRPC.h in Headers */,
93BD276F1EE737A8002BB00B /* ServiceRemoteWordPressComREST.h in Headers */,
93BD277D1EE73944002BB00B /* NSDate+WordPressJSON.h in Headers */,
93BD273B1EE73282002BB00B /* AccountServiceRemote.h in Headers */,
93BD27691EE736A8002BB00B /* RemoteUser.h in Headers */,
74B5F0DC1EF829B800B411E7 /* BlogServiceRemote.h in Headers */,
Expand Down Expand Up @@ -3393,6 +3404,7 @@
93BD277F1EE73944002BB00B /* WordPressComOAuthClient.swift in Sources */,
740B23B91F17EC7300067A2A /* PostServiceRemoteREST.m in Sources */,
93BD27801EE73944002BB00B /* WordPressComRestApi.swift in Sources */,
3FFCC04F2BABA6E60051D229 /* Date+WordPressCom.swift in Sources */,
404057D2221C56AB0060250C /* StatsTopCountryTimeIntervalData.swift in Sources */,
E11C2AD21FA77FB90023BDE2 /* SitePlugin.swift in Sources */,
4A68E3DF29407100004AC3DC /* RemoteReaderTopic.swift in Sources */,
Expand Down Expand Up @@ -3427,7 +3439,6 @@
9311A68B1F22625A00704AC9 /* TaxonomyServiceRemoteXMLRPC.m in Sources */,
C797196E2679007B0072F984 /* SelfHostedPluginManagementClient.swift in Sources */,
40414060220F9F1F00CF7C5B /* StatsAllTimesInsight.swift in Sources */,
93BD277E1EE73944002BB00B /* NSDate+WordPressJSON.m in Sources */,
8B2F4BED24ABCAEF0056C08A /* Decodable+Dictionary.swift in Sources */,
E194CB731FBDEF6500B0A8B8 /* PluginState.swift in Sources */,
4A57A6882B54C68C008D0660 /* Constants.m in Sources */,
Expand Down Expand Up @@ -3459,6 +3470,7 @@
E632D7781F6E047400297F6D /* SocialLogin2FANonceInfo.swift in Sources */,
32FC1D29255C91ED00CD0A7B /* JetpackScanServiceRemote.swift in Sources */,
9F3E0B9B208732B3009CB5BA /* RemoteReaderSiteInfoSubscription.swift in Sources */,
3FFCC0472BAA6EF40051D229 /* NSDate+WordPressCom.swift in Sources */,
7403A2E41EF06ED500DED7DC /* AccountSettingsRemote.swift in Sources */,
3236F77824AE34B40088E8F3 /* ReaderTopicServiceRemote+Interests.swift in Sources */,
FE20A6A4282A96C00025E975 /* RemoteBloggingPromptsSettings.swift in Sources */,
Expand Down Expand Up @@ -3517,6 +3529,7 @@
74C473AC1EF2F75E009918F2 /* SiteManagementServiceRemote.swift in Sources */,
74585B971F0D54B400E7E667 /* RemoteDomain.swift in Sources */,
0C1C08432B9CD8D200E52F8C /* PostServiceRemoteREST+Extended.swift in Sources */,
3FFCC0492BAB98130051D229 /* DateFormatter+WordPressCom.swift in Sources */,
74A44DD01F13C64B006CD8F4 /* RemoteNotification.swift in Sources */,
8B52B901257AC5A200221663 /* Date+endOfDay.swift in Sources */,
E1D6B558200E473A00325669 /* TimeZoneServiceRemote.swift in Sources */,
Expand Down Expand Up @@ -3611,11 +3624,13 @@
F4B0F4802ACB4EA9003ABC61 /* AllDomainsResultDomainTests.swift in Sources */,
74585B901F0D51F900E7E667 /* DomainsServiceRemoteRESTTests.swift in Sources */,
BAFA775624ADAB3C000F0D3A /* MockPluginDirectoryEntryProvider.swift in Sources */,
3FFCC0412BA995290051D229 /* Date+WordPressComTests.swift in Sources */,
3F8308A729EE683500354497 /* ActivityTests.swift in Sources */,
9AB6D64A218727D60008F274 /* PostServiceRemoteRESTRevisionsTest.swift in Sources */,
01438D382B6A35FB0097D60A /* stats-summary.json in Sources */,
7430C9BD1F192C0F0051B8E6 /* ReaderPostServiceRemoteTests.m in Sources */,
1DC837C229B9F04F009DCD4B /* RemoteVideoPressVideoTests.swift in Sources */,
3FFCC04D2BABA6980051D229 /* NSDate+WordPressComTests.swift in Sources */,
FAD1345125909DEA00A8FEB1 /* JetpackBackupServiceRemoteTests.swift in Sources */,
8B2F4BE924ABC9DC0056C08A /* ReaderPostServiceRemote+CardsTests.swift in Sources */,
40F9880C221ACEEE00B7B369 /* StatsRemoteV2Tests.swift in Sources */,
Expand Down Expand Up @@ -3643,6 +3658,7 @@
4A05E79C2B2FDC6100C25E3B /* WordPressOrgAPITests.swift in Sources */,
3297E1DE2564653A00287D21 /* JetpackScanServiceRemoteTests.swift in Sources */,
01438D352B6A2B2C0097D60A /* stats-visits-month-unit-week.json in Sources */,
3FFCC04B2BABA5220051D229 /* DateFormatter+WordPressComTests.swift in Sources */,
9F3E0BAC20873785009CB5BA /* ServiceRequestTest.swift in Sources */,
4624223E2548C26D002B8A12 /* SiteDesignServiceRemoteTests.swift in Sources */,
4A1DEF44293051BC00322608 /* LoggingTests.swift in Sources */,
Expand Down
19 changes: 19 additions & 0 deletions WordPressKit/Date+WordPressCom.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extension Date {

/// Parses a date string
///
/// Dates in the format specified in http://www.w3.org/TR/NOTE-datetime should be OK.
/// The kind of dates returned by the REST API should match that format, even if the doc promises ISO 8601.
///
/// Parsing the full ISO 8601, or even RFC 3339 is more complex than this, and makes no sense right now.
///
/// - SeeAlso: [WordPress.com REST API docs](https://developer.wordpress.com/docs/api/)
/// - Warning: This method doesn't support fractional seconds or dates with leap seconds (23:59:60 turns into 23:59:00)
static func with(wordPressComJSONString jsonString: String) -> Date? {
DateFormatter.wordPressCom.date(from: jsonString)
}

var wordPressComJSONString: String {
DateFormatter.wordPressCom.string(from: self)
}
}
13 changes: 13 additions & 0 deletions WordPressKit/DateFormatter+WordPressCom.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extension DateFormatter {

/// A `DateFormatter` configured to manage dates compatible with the WordPress.com API.
///
/// - SeeAlso: [https://developer.wordpress.com/docs/api/](https://developer.wordpress.com/docs/api/)
static let wordPressCom: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ssZ"
formatter.timeZone = NSTimeZone(forSecondsFromGMT: 0) as TimeZone
formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") as Locale
return formatter
}()
}
30 changes: 30 additions & 0 deletions WordPressKit/NSDate+WordPressCom.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Foundation

// This `NSDate` extension wraps the `Date` implementation.
//
// It's done in two types because we cannot expose the `Date` methods to Objective-C, since `Date` is not a class:
//
// `@objc can only be used with members of classes, @objc protocols, and concrete extensions of classes`
extension NSDate {

/// Parses a date string
///
/// Dates in the format specified in http://www.w3.org/TR/NOTE-datetime should be OK.
/// The kind of dates returned by the REST API should match that format, even if the doc promises ISO 8601.
///
/// Parsing the full ISO 8601, or even RFC 3339 is more complex than this, and makes no sense right now.
///
/// - SeeAlso: [WordPress.com REST API docs](https://developer.wordpress.com/docs/api/)
/// - Warning: This method doesn't support fractional seconds or dates with leap seconds (23:59:60 turns into 23:59:00)
//
// Needs to be `public` because of the usages in the Objective-C code.
@objc(dateWithWordPressComJSONString:)
public static func with(wordPressComJSONString jsonString: String) -> Date? {
Date.with(wordPressComJSONString: jsonString)
}

@objc(WordPressComJSONString)
public func wordPressComJSONString() -> String {
(self as Date).wordPressComJSONString
}
}
21 changes: 0 additions & 21 deletions WordPressKit/NSDate+WordPressJSON.h

This file was deleted.

26 changes: 0 additions & 26 deletions WordPressKit/NSDate+WordPressJSON.m

This file was deleted.

2 changes: 1 addition & 1 deletion WordPressKit/PostServiceRemoteREST+Extended.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private func decodePost(from object: AnyObject) async throws -> RemotePost {

private func makeParameters<T: Encodable>(from value: T) throws -> [String: AnyObject] {
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .formatted(NSDate.rfc3339DateFormatter())
encoder.dateEncodingStrategy = .formatted(.wordPressCom)
let data = try encoder.encode(value)
let object = try JSONSerialization.jsonObject(with: data)
guard let dictionary = object as? [String: AnyObject] else {
Expand Down
2 changes: 1 addition & 1 deletion WordPressKit/RemoteCommentV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension RemoteCommentV2: Decodable {

// since `date_gmt` is already in GMT timezone, manually add the timezone string to make the rfc3339 formatter happy (or it will throw otherwise).
guard let dateString = try? container.decode(String.self, forKey: .date),
let date = NSDate(wordPressComJSONString: dateString + "+00:00") as Date? else {
let date = NSDate.with(wordPressComJSONString: dateString + "+00:00") else {
throw DecodingError.dataCorruptedError(forKey: .date, in: container, debugDescription: "Date parsing failed")
}
self.date = date
Expand Down
1 change: 0 additions & 1 deletion WordPressKit/WordPressKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ FOUNDATION_EXPORT const unsigned char WordPressKitVersionString[];
#import <WordPressKit/RemoteTheme.h>
#import <WordPressKit/RemoteUser.h>

#import <WordPressKit/NSDate+WordPressJSON.h>
#import <WordPressKit/NSString+MD5.h>

#import <WordPressKit/WPKitLogging.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class CommentServiceRemoteREST_APIv2Tests: RemoteTestCase, RESTTestable {
XCTAssertEqual(firstComment.authorID, 135)
XCTAssertEqual(firstComment.authorName, "John Doe")
XCTAssertEqual(firstComment.authorURL, "https://example.com/john-doe")
XCTAssertEqual(firstComment.date, NSDate(wordPressComJSONString: "2021-07-01T10:50:11+00:00") as Date)
XCTAssertEqual(firstComment.date, NSDate.with(wordPressComJSONString: "2021-07-01T10:50:11+00:00"))
XCTAssertEqual(firstComment.content, "<p>Some example comment.</p>\n")
XCTAssertEqual(firstComment.link, "https://example.com/2021/05/25/example-post/comment-page-1/#comment-2")
XCTAssertEqual(firstComment.status, "approve") // verify that it's converted correctly.
Expand Down
Loading