-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpeciesModelTests.swift
59 lines (51 loc) · 1.89 KB
/
SpeciesModelTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//
// SpeciesModelTests.swift
// SwapiSwiftTests
//
// Created by Joe Bramhall on 12/31/19.
// Copyright © 2019 thinx. All rights reserved.
//
import XCTest
@testable import SwapiSwift
class SpeciesModelTests: XCTestCase {
private struct ExpectedResults {
static let name = "Hutt"
static let classification = "gastropod"
static let designation = "sentient"
static let averageHeight = "300"
static let skinColors = "green, brown, tan"
static let hairColors = "n/a"
static let eyeColors = "yellow, red"
static let lifespan = "1000"
static let homeworld = "https://swapi.co/api/planets/24/"
static let languiage = "Huttese"
static let people = ["https://swapi.co/api/people/16/"]
static var films: [String] {
["https://swapi.co/api/films/3/", "https://swapi.co/api/films/1/"]
}
static let url = "https://swapi.co/api/species/5/"
}
var sut: Species?
override func setUp() {
sut = sampleSpecies
}
override func tearDown() {
sut = nil
}
/// Some simple tests to validate parsing a `Species` data model.
func testSpeciesParsing() {
XCTAssertEqual(sut?.name, ExpectedResults.name)
XCTAssertEqual(sut?.classification, ExpectedResults.classification)
XCTAssertEqual(sut?.designation, ExpectedResults.designation)
XCTAssertEqual(sut?.averageHeight, ExpectedResults.averageHeight)
XCTAssertEqual(sut?.skinColors, ExpectedResults.skinColors)
XCTAssertEqual(sut?.hairColors, ExpectedResults.hairColors)
XCTAssertEqual(sut?.eyeColors, ExpectedResults.eyeColors)
XCTAssertEqual(sut?.averageLifespan, ExpectedResults.lifespan)
XCTAssertEqual(sut?.homeworld, ExpectedResults.homeworld)
XCTAssertEqual(sut?.language, ExpectedResults.languiage)
XCTAssertEqual(sut?.people, ExpectedResults.people)
XCTAssertEqual(sut?.films, ExpectedResults.films)
XCTAssertEqual(sut?.url, ExpectedResults.url)
}
}