amadeu01 / the-movie-db-client

The Movie DB iOS Client
MIT License
0 stars 0 forks source link

Testar estrutura Endpoints. #2

Open amadeu01 opened 6 years ago

amadeu01 commented 6 years ago

Não sei como seria a forma mais adequada de testar e o que devo testar.

https://github.com/amadeu01/the-movie-db-client/blob/df6cec47ddc1b43b6eb7252b535c6b51b23af3ce/The%20Movie%20DB%20Client/Common/Endpoint.swift#L23

https://github.com/amadeu01/the-movie-db-client/blob/df6cec47ddc1b43b6eb7252b535c6b51b23af3ce/The%20Movie%20DB%20Client/Common/Endpoint.swift#L28

Devo testar se a url que é retornada nessa estrutura bate com a URL esperada?

ronanrodrigo commented 6 years ago

Vc tem que testar, dada todas as possibilidades, se as URLs são montadas corretamente. Por exemplo:

final class SearchEndpointTests: XCTestCase {
    // test <Method or Property> when <Condition> then <Expected>
    func testPathWhenFetchThenReturnSearchPath() {
        // Arrange
        let fetch = Endpoints.Search.fetch

        // Act
        let path = fetch.path

        // Assert
        XCTAssertEqual(path, "/search/")
    }
}
ronanrodrigo commented 6 years ago

@amadeu01 atualizei meu comentário acima. Eu tinha feito um comentário errado no código.

amadeu01 commented 6 years ago

Beleza!