Skip to content

Commit

Permalink
some clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ualch9 committed Sep 20, 2020
1 parent 888940f commit fe1aa36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let package = Package(
.macOS(.v10_12)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "MeteorologicalServiceOfCanada",
targets: ["MeteorologicalServiceOfCanada"]),
Expand All @@ -21,8 +20,6 @@ let package = Package(
.package(url: "https://github.com/GEOSwift/geos.git", from: "5.0.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "MeteorologicalServiceOfCanada",
dependencies: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ final class ObservationStationTests: XCTestCase {
let msc = MeteorologicalServiceOfCanada()
var stations: [ObservationStation] = []

override func setUp() {
let geoJSON = try! JSONDecoder().decode(GeoJSON.self, from: Fixtures.Site_List_En)
guard case let .featureCollection(collection) = geoJSON else { fatalError() }
override func setUpWithError() throws {
let geoJSON = try MeteorologicalServiceOfCanada.jsonDecoder.decode(GeoJSON.self, from: Fixtures.Site_List_En)
guard case let .featureCollection(collection) = geoJSON else { fatalError("Expected a feature collection") }
self.stations = collection.features.compactMap { ObservationStation(fromGeoJSONFeature: $0) }
}

Expand All @@ -23,17 +23,18 @@ final class ObservationStationTests: XCTestCase {
ObservationStation(fromGeoJSONFeature: feature)
}

let stationS1 = stations.first { $0.code == "s0000001" }!
XCTAssertEqual(stationS1.name, "Athabasca")
XCTAssertEqual(stationS1.provinceCode, "AB")
XCTAssertEqual(stationS1.latitude, 54.72, accuracy: 0.001)
XCTAssertEqual(stationS1.longitude, -113.28, accuracy: 0.001)
let stationS1 = stations.filter { $0.code == "s0000001" }.first
XCTAssertNotNil(stationS1)
XCTAssertEqual(stationS1!.name, "Athabasca")
XCTAssertEqual(stationS1!.provinceCode, "AB")
XCTAssertEqual(stationS1!.latitude, 54.72, accuracy: 0.001)
XCTAssertEqual(stationS1!.longitude, -113.28, accuracy: 0.001)
}

// MARK: - MSCGetStations operation
func testGetStations() throws {
let record = StationsRecord(boundary: MeteorologicalServiceOfCanada.canada)
let getStationsOp = MSCGetStations(decoder: JSONDecoder(), stations: record)
let getStationsOp = MSCGetStations(decoder: MeteorologicalServiceOfCanada.jsonDecoder, stations: record)
getStationsOp.start()
getStationsOp.waitUntilFinished()

Expand Down

0 comments on commit fe1aa36

Please sign in to comment.