From dd89f2dea775797fbbde0870652fcb1284e2a737 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 19 Dec 2017 13:28:33 -0800 Subject: [PATCH] =?UTF-8?q?Add=20test=20for=20Macworld=20authors=20?= =?UTF-8?q?=E2=80=94=C2=A0make=20sure=20they=20appear=20as=20names=20inste?= =?UTF-8?q?ad=20of=20email=20addresses,=20even=20though=20they=E2=80=99re?= =?UTF-8?q?=20using=20RSS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RSParser/RSParserTests/RSSParserTests.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Frameworks/RSParser/RSParserTests/RSSParserTests.swift b/Frameworks/RSParser/RSParserTests/RSSParserTests.swift index deecde88c..d511c0db6 100644 --- a/Frameworks/RSParser/RSParserTests/RSSParserTests.swift +++ b/Frameworks/RSParser/RSParserTests/RSSParserTests.swift @@ -93,6 +93,21 @@ class RSSParserTests: XCTestCase { XCTAssertNotNil(article.uniqueID) XCTAssertEqual(article.uniqueID.count, 32) // calculated unique IDs are MD5 hashes } + } + func testMacworldAuthors() { + + // Macworld uses names instead of email addresses (despite the RSS spec saying they should be email addresses). + + let d = parserData("macworld", "rss", "https://www.macworld.com/") + let parsedFeed = try! FeedParser.parse(d)! + + for article in parsedFeed.items { + + let author = article.authors!.first! + XCTAssertNil(author.emailAddress) + XCTAssertNil(author.url) + XCTAssertNotNil(author.name) + } } }