Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
XanSmarty committed Oct 26, 2023
1 parent d83e1e0 commit 582c101
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tests/SmartyStreetsTests/ClientBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class ClientBuilderTests: XCTestCase {
XCTAssertEqual(client.maxTimeout, 10000)
XCTAssertEqual(client.debug, false)
XCTAssertEqual(client.internationalStreetApiURL, "https://international-street.api.smarty.com/verify")
XCTAssertEqual(client.internationalAutocompleteApiURL, "https://international-autocomplete.api.smarty.com/v2/lookup")
XCTAssertEqual(client.internationalAutocompleteApiDeprecatedURL, "https://international-autocomplete.api.smarty.com/lookup")
XCTAssertEqual(client.usAutocompleteApiURL, "https://us-autocomplete.api.smarty.com/suggest")
XCTAssertEqual(client.usExtractApiURL, "https://us-extract.api.smarty.com")
XCTAssertEqual(client.usStreetApiURL, "https://us-street.api.smarty.com/street-address")
Expand Down
40 changes: 40 additions & 0 deletions Tests/SmartyStreetsTests/URLPrefixSenderTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import XCTest
@testable import SmartyStreets

class URLPrefixSenderTests: XCTestCase {

var urlPrefixSender:URLPrefixSender!

override func setUp() {
super.setUp()
let nilInner: Any? = nil
self.urlPrefixSender = URLPrefixSender(urlPrefix: "http://mysite.com/lookup", inner: nilInner!)
}

override func tearDown() {
super.tearDown()
self.urlPrefixSender = nil
}

func testRequestURLPresent() {
let request:SmartyRequest = SmartyRequest()
request.urlPrefix = "/jimbo"

var error: NSError? = NSError()
_ = self.urlPrefixSender.sendRequest(request: request, error: &error)

XCTAssertEqual(request.urlPrefix, "http://mysite.com/lookup/jimbo")

}

func testRequestURLNotPresent() {
let request:SmartyRequest = SmartyRequest()

var error: NSError? = NSError()
_ = self.urlPrefixSender.sendRequest(request: request, error: &error)

XCTAssertEqual(request.urlPrefix, "http://mysite.com/lookup")
}


}

0 comments on commit 582c101

Please sign in to comment.