//
//  WeatherAppTests.swift
//  WeatherAppTests
//
//  Created by Alex Paul on 1/17/19.
//  Copyright © 2019 Pursuit. All rights reserved.
//

import XCTest
@testable import WeatherApp

class WeatherAppTests: XCTestCase {
  
  override func setUp() {
    // Put setup code here. This method is called before the invocation of each test method in the class.
  }
  
  override func tearDown() {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
  }
  
  func testGetLocationName() {
    let zipcode = "11375"
    let exp = expectation(description: "found location name")
    ZipCodeHelper.getLocationName(from: zipcode) { (error, localityName) in
      if let error = error {
        XCTFail("failed to get location name: \(error)")
      } else if let localityName = localityName {
        XCTAssertEqual(localityName, "New York", "should equal to New York")
      }
      exp.fulfill()
    }
    wait(for: [exp], timeout: 3.0)
  }
  
  
}
