Skip to content

Commit

Permalink
test: simple test for decoding PodcastPerson
Browse files Browse the repository at this point in the history
  • Loading branch information
devahmedshendy committed Sep 6, 2023
1 parent b7b8935 commit e2171d9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Tests/SyndiKitTests/RSSCodedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,42 @@ public final class SyndiKitTests: XCTestCase {
XCTAssertNotNil(episode.summary)
}

func testEpisodePodcastPerson() {
guard let feed = try? Content.xmlFeeds["empowerapps-show-cdata_summary"]?.get() else {
XCTFail("Missing Podcast \(name)")
return
}

guard let rss = feed as? RSSFeed else {
XCTFail("Wrong Type \(name)")
return
}

let item1Title = "WWDC Spectacular (Part 2) with Peter Witham"
let item2Title = "How to WWDC with Peter Witham"

let items = rss.channel.items.filter { $0.title == item1Title || $0.title == item2Title }

XCTAssertFalse(items.isEmpty)

for item in items {
let host = item.podcastPerson?.first(where: { $0.role.lowercased() == "host" })

XCTAssertNotNil(host)
XCTAssertEqual(host?.name, "Leo Dion")
XCTAssertEqual(host?.href, "https://brightdigit.com")
XCTAssertEqual(host?.img, "https://images.transistor.fm/file/transistor/images/person/401f05b8-f63f-4b96-803f-c7ac9233b459/1664979700-image.jpg")

// Both podcasts have the same guest
let guest = item.podcastPerson?.first(where: { $0.role.lowercased() == "guest" })

XCTAssertNotNil(guest)
XCTAssertEqual(guest?.name, "CompileSwift")
XCTAssertEqual(guest?.href, "https://compileswift.com")
XCTAssertEqual(guest?.img, "https://images.transistor.fm/file/transistor/images/person/e36ebf22-69fa-4e4f-a79b-1348c4d39267/1668262451-image.jpg")
}
}

func testEpisodeCDataSummary() {
guard let feed = try? Content.xmlFeeds["empowerapps-show-cdata_summary"]?.get() else {
XCTFail("Missing Podcast \(name)")
Expand Down

0 comments on commit e2171d9

Please sign in to comment.