Skip to content

Commit

Permalink
venmo#93 Add tests for dataTask with URL
Browse files Browse the repository at this point in the history
  • Loading branch information
m-herold committed Sep 23, 2019
1 parent 9b60014 commit 70cd45a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Tests/DVRTests/SessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,32 @@ class SessionTests: XCTestCase {
XCTFail()
}
}

func testDataTaskWithUrl() {
let url = URL(string: "http://example.com")!
let dataTask = session.dataTask(with: url)

XCTAssert(dataTask is SessionDataTask)

if let dataTask = dataTask as? SessionDataTask, let headers = dataTask.request.allHTTPHeaderFields {
XCTAssert(headers["testSessionHeader"] == "testSessionHeaderValue")
} else {
XCTFail()
}
}

func testDataTaskWithUrlAndCompletion() {
let url = URL(string: "http://example.com")!
let dataTask = session.dataTask(with: url, completionHandler: { _, _, _ in return })

XCTAssert(dataTask is SessionDataTask)

if let dataTask = dataTask as? SessionDataTask, let headers = dataTask.request.allHTTPHeaderFields {
XCTAssert(headers["testSessionHeader"] == "testSessionHeaderValue")
} else {
XCTFail()
}
}

func testPlayback() {
session.recordingEnabled = false
Expand Down

0 comments on commit 70cd45a

Please sign in to comment.