From b380d0597f4125628f7ee2756b541efb78de9eef Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 19 Dec 2017 11:20:40 -0800 Subject: [PATCH] =?UTF-8?q?Test=20Omni=20Show=20and=20Macworld=20unique=20?= =?UTF-8?q?IDs.=20The=20Omni=20Show=20ids=20should=20come=20from=20the=20f?= =?UTF-8?q?eed=E2=80=99s=20guids.=20Macworld=E2=80=99s=20unique=20IDs=20sh?= =?UTF-8?q?ould=20be=20calculated,=20since=20the=20feed=20doesn=E2=80=99t?= =?UTF-8?q?=20have=20guids.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RSParser/RSParserTests/RSSParserTests.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Frameworks/RSParser/RSParserTests/RSSParserTests.swift b/Frameworks/RSParser/RSParserTests/RSSParserTests.swift index 36c4f5091..deecde88c 100644 --- a/Frameworks/RSParser/RSParserTests/RSSParserTests.swift +++ b/Frameworks/RSParser/RSParserTests/RSSParserTests.swift @@ -71,7 +71,7 @@ class RSSParserTests: XCTestCase { } } - func testTheOmniShow() { + func testTheOmniShowUniqueIDs() { let d = parserData("theomnishow", "rss", "https://theomnishow.omnigroup.com/") let parsedFeed = try! FeedParser.parse(d)! @@ -81,4 +81,18 @@ class RSSParserTests: XCTestCase { XCTAssertTrue(article.uniqueID.hasPrefix("https://theomnishow.omnigroup.com/episode/")) } } + + func testMacworldUniqueIDs() { + + // Macworld’s feed doesn’t have guids, so they should be calculated unique IDs. + + let d = parserData("macworld", "rss", "https://www.macworld.com/") + let parsedFeed = try! FeedParser.parse(d)! + + for article in parsedFeed.items { + XCTAssertNotNil(article.uniqueID) + XCTAssertEqual(article.uniqueID.count, 32) // calculated unique IDs are MD5 hashes + } + + } }