? {
guard let regex else { return nil }
diff --git a/Tests/WordPressKitTests/WordPressKitTests/Tests/RemoteReaderPostTests.m b/Tests/WordPressKitTests/WordPressKitTests/Tests/RemoteReaderPostTests.m
index 05c35eb3becd..771b7f2c6707 100644
--- a/Tests/WordPressKitTests/WordPressKitTests/Tests/RemoteReaderPostTests.m
+++ b/Tests/WordPressKitTests/WordPressKitTests/Tests/RemoteReaderPostTests.m
@@ -105,6 +105,21 @@ - (void)testSummaryIsPlainText {
XCTAssertTrue([str isEqualToString:sanatizedStr], @"The post summary was not plain text.");
}
+- (void)testSummaryConvertsLineBreaksToSpaces {
+ RemoteReaderPost *remoteReaderPost = [RemoteReaderPost alloc];
+ NSDictionary *dict = @{@"excerpt": @"Yes,
look behind
"};
+ NSString *summary = [remoteReaderPost postSummaryFromPostDictionary:dict orPostContent:@""];
+ XCTAssertEqualObjects(summary, @"Yes, look behind", @"A
in the API excerpt should become a space instead of running words together.");
+}
+
+- (void)testSummaryFallsBackToContentWhenExcerptIsEmpty {
+ RemoteReaderPost *remoteReaderPost = [RemoteReaderPost alloc];
+ NSDictionary *dict = @{@"excerpt": @""};
+ NSString *content = @"Generated from the post content.
";
+ NSString *summary = [remoteReaderPost postSummaryFromPostDictionary:dict orPostContent:content];
+ XCTAssertEqualObjects(summary, @"Generated from the post content.", @"An empty API excerpt should fall back to a summary generated from the post content.");
+}
+
- (void)testSiteIsAtomic {
NSString *key = @"site_is_atomic";