- 
                Notifications
    
You must be signed in to change notification settings  - Fork 37
 
Open
Description
@gkye @djpearce
Sorry to bother you.
I'm not sure I understand the data structure for these nested types correctly, but imdb_id (and others) seem to not be decoding correctly.
First of all, it's a string in json and the prop is Int!
I augmented tests below to confirm. Let me open a PR soon.
TheMovieDatabaseSwiftWrapper/Tests/TMDBSwiftTests/MovieMDBTests.swift
Lines 34 to 46 in 094a8d9
| func testMovieById() { | |
| var data: MovieDetailedMDB? | |
| let expectation = self.expectation(description: "Wait for data to load.") | |
| MovieMDB.movie(movieID: 7984) { _, movie in | |
| data = movie | |
| expectation.fulfill() | |
| } | |
| waitForExpectations(timeout: expecationTimeout, handler: nil) | |
| XCTAssertNotNil(data) | |
| XCTAssertEqual(data?.title, "In the Name of the Father") | |
| } | 
    func testMovieById() {
        var data: MovieDetailedMDB?
        let expectation = self.expectation(description: "Wait for data to load.")
        MovieMDB.movie(movieID: 7984) { ddd, movie in
            debugPrint(String(data: ddd.data!, encoding: .utf8))
            data = movie
            expectation.fulfill()
        }
        waitForExpectations(timeout: expectationTimeout, handler: nil)
        XCTAssertNotNil(data)
        XCTAssertEqual(data?.title, "In the Name of the Father")
        XCTAssertEqual(data?.imdb_id, "tt0107207") // fails `nil`
        XCTAssertEqual(data?.homepage, "") // fails `nil`
        XCTAssertEqual(data?.runtime, 133) // fails `nil`
    }
    func testMovieDetailById() {
        var data: MovieDetailedMDB?
        let expectation = self.expectation(description: "Wait for data to load.")
        MovieDetailedMDB.movie(movieID: 7984) { ddd, movie in
            debugPrint(String(data: ddd.data!, encoding: .utf8))
            data = movie
            expectation.fulfill()
        }
        waitForExpectations(timeout: expectationTimeout, handler: nil)
        XCTAssertNotNil(data)
        XCTAssertEqual(data?.title, "In the Name of the Father")
        XCTAssertEqual(data?.imdb_id, "tt0107207") // fails `nil`
        XCTAssertEqual(data?.homepage, "") // fails `nil`
        XCTAssertEqual(data?.runtime, 133) // fails `nil`
    }Metadata
Metadata
Assignees
Labels
No labels