Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getPeopleInEpisode #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common/Models/People/TraktCastMember.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct TVCastMember: Codable, Hashable {
public let characters: [String]
@available(*, deprecated, renamed: "characters")
public let character: String
public let episodeCount: Int
public let episodeCount: Int?
public let person: Person

enum CodingKeys: String, CodingKey {
Expand Down
2 changes: 1 addition & 1 deletion Common/Models/People/TraktCrewMember.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct TVCrewMember: Codable, Hashable {
public let jobs: [String]
@available(*, deprecated, renamed: "jobs")
public let job: String
public let episodeCount: Int
public let episodeCount: Int?
public let person: Person

enum CodingKeys: String, CodingKey {
Expand Down
7 changes: 5 additions & 2 deletions TraktKitTests/EpisodeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,17 @@ class EpisodeTests: XCTestCase {
traktManager.getPeopleInEpisode(showID: "game-of-thrones", season: 1, episode: 1) { result in
if case .success(let castAndCrew) = result {
XCTAssertNotNil(castAndCrew.cast)
XCTAssertNotNil(castAndCrew.producers)
XCTAssertNotNil(castAndCrew.writers)
XCTAssertEqual(castAndCrew.cast!.count, 20)
XCTAssertEqual(castAndCrew.producers!.count, 14)
XCTAssertEqual(castAndCrew.writers!.count, 2)

guard let actor = castAndCrew.cast?.first else { XCTFail("Cast is empty"); return }
XCTAssertEqual(actor.person.name, "Emilia Clarke")
XCTAssertEqual(actor.characters, ["Daenerys Targaryen"])
}
else {
XCTFail("Invalid result")
}
expectation.fulfill()
}
let result = XCTWaiter().wait(for: [expectation], timeout: 5)
Expand Down