Last active
July 24, 2021 05:33
-
-
Save ykpoh/59a150597d39f48fbef85dc38c8fe9cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
@testable import SpaceXLaunch // 1 | |
class LaunchResponseTests: XCTestCase, DecodableTestCase { // 2 | |
var sut: LaunchResponse! // 3 | |
override func setUpWithError() throws { | |
// Put setup code here. This method is called before the invocation of each test method in the class. | |
try super.setUpWithError() | |
try! givenSUTFromJSON() // 4 | |
} | |
override func tearDownWithError() throws { | |
// Put teardown code here. This method is called after the invocation of each test method in the class. | |
sut = nil // 5 | |
try super.tearDownWithError() | |
} | |
// MARK: - Type Tests | |
func testConformsToDecodable() { // 6 | |
XCTAssertTrue((sut as Any) is Decodable) // cast silences a warning | |
} | |
func testConformsToEquatable() { // 7 | |
XCTAssertEqual(sut, sut) // requires Equatable conformance | |
} | |
func testDecodableSetsDocs() { // 8 | |
XCTAssertNotNil(sut.docs) | |
XCTAssertEqual(sut.docs?.count ?? -1, 2) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment