Test Omni Show and Macworld unique IDs. The Omni Show ids should come from the feed’s guids. Macworld’s unique IDs should be calculated, since the feed doesn’t have guids.

This commit is contained in:
Brent Simmons 2017-12-19 11:20:40 -08:00
parent fefa96d259
commit b380d0597f
1 changed files with 15 additions and 1 deletions

View File

@ -71,7 +71,7 @@ class RSSParserTests: XCTestCase {
} }
} }
func testTheOmniShow() { func testTheOmniShowUniqueIDs() {
let d = parserData("theomnishow", "rss", "https://theomnishow.omnigroup.com/") let d = parserData("theomnishow", "rss", "https://theomnishow.omnigroup.com/")
let parsedFeed = try! FeedParser.parse(d)! let parsedFeed = try! FeedParser.parse(d)!
@ -81,4 +81,18 @@ class RSSParserTests: XCTestCase {
XCTAssertTrue(article.uniqueID.hasPrefix("https://theomnishow.omnigroup.com/episode/")) XCTAssertTrue(article.uniqueID.hasPrefix("https://theomnishow.omnigroup.com/episode/"))
} }
} }
func testMacworldUniqueIDs() {
// Macworlds feed doesnt 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
}
}
} }