Add tests for Dr. Drang’s JSON Feed.

This commit is contained in:
Brent Simmons 2017-11-30 13:19:22 -08:00
parent b817213393
commit efcc4fedaa
4 changed files with 21 additions and 1 deletions

View File

@ -63,6 +63,7 @@
845213251FCB3C76003B6E93 /* coco.html in Resources */ = {isa = PBXBuildFile; fileRef = 845213241FCB3C75003B6E93 /* coco.html */; };
845213281FCB4042003B6E93 /* RSHTMLTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 845213261FCB4042003B6E93 /* RSHTMLTag.h */; settings = {ATTRIBUTES = (Public, ); }; };
845213291FCB4042003B6E93 /* RSHTMLTag.m in Sources */ = {isa = PBXBuildFile; fileRef = 845213271FCB4042003B6E93 /* RSHTMLTag.m */; };
84566D941FD0ABFB00103322 /* allthis.json in Resources */ = {isa = PBXBuildFile; fileRef = 84566D931FD0ABFB00103322 /* allthis.json */; };
84628AAD1FCA10AE00566A9B /* allthis.atom in Resources */ = {isa = PBXBuildFile; fileRef = 84628AAC1FCA10AE00566A9B /* allthis.atom */; };
848674D21FCE7BF600802D1F /* macworld.rss in Resources */ = {isa = PBXBuildFile; fileRef = 848674D11FCE7BF500802D1F /* macworld.rss */; };
849A03D01F0081EA00122600 /* DaringFireball.html in Resources */ = {isa = PBXBuildFile; fileRef = 849A03C51F0081EA00122600 /* DaringFireball.html */; };
@ -164,6 +165,7 @@
845213241FCB3C75003B6E93 /* coco.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = coco.html; sourceTree = "<group>"; };
845213261FCB4042003B6E93 /* RSHTMLTag.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RSHTMLTag.h; sourceTree = "<group>"; };
845213271FCB4042003B6E93 /* RSHTMLTag.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RSHTMLTag.m; sourceTree = "<group>"; };
84566D931FD0ABFB00103322 /* allthis.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = allthis.json; sourceTree = "<group>"; };
84628AAC1FCA10AE00566A9B /* allthis.atom */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = allthis.atom; sourceTree = "<group>"; };
848674D11FCE7BF500802D1F /* macworld.rss */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = macworld.rss; sourceTree = "<group>"; };
849A03C51F0081EA00122600 /* DaringFireball.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DaringFireball.html; sourceTree = "<group>"; };
@ -362,6 +364,7 @@
845213241FCB3C75003B6E93 /* coco.html */,
849A03CE1F0081EA00122600 /* sixcolors.html */,
84628AAC1FCA10AE00566A9B /* allthis.atom */,
84566D931FD0ABFB00103322 /* allthis.json */,
849A03CF1F0081EA00122600 /* Subs.opml */,
);
path = Resources;
@ -544,6 +547,7 @@
849A03D61F0081EA00122600 /* manton.rss in Resources */,
849A03D11F0081EA00122600 /* DaringFireball.rss in Resources */,
849A03D01F0081EA00122600 /* DaringFireball.html in Resources */,
84566D941FD0ABFB00103322 /* allthis.json in Resources */,
84628AAD1FCA10AE00566A9B /* allthis.atom in Resources */,
848674D21FCE7BF600802D1F /* macworld.rss in Resources */,
849A03EA1F01F92B00122600 /* inessential.json in Resources */,

View File

@ -119,7 +119,14 @@ class FeedParserTypeTests: XCTestCase {
let type = feedType(d)
XCTAssertTrue(type == .jsonFeed)
}
func testAllThisJSONFeedType() {
let d = parserData("allthis", "json", "http://leancrew.com/allthis/")
let type = feedType(d)
XCTAssertTrue(type == .jsonFeed)
}
// MARK: Performance
func testFeedTypePerformance() {

View File

@ -58,4 +58,12 @@ class JSONFeedParserTests: XCTestCase {
XCTAssert(parsedFeed.faviconURL == "https://daringfireball.net/graphics/favicon-64.png")
XCTAssert(parsedFeed.iconURL == "https://daringfireball.net/graphics/apple-touch-icon.png")
}
func testAllThis() {
let d = parserData("allthis", "json", "http://leancrew.com/allthis/")
let parsedFeed = try! FeedParser.parse(d)!
XCTAssertEqual(parsedFeed.items.count, 12)
}
}

File diff suppressed because one or more lines are too long