Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tests #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions EventSourceTests/EventSourceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@
import XCTest
@testable import EventSource

class EventSourceTests: XCTestCase {
final class EventSourceTests: XCTestCase {

var eventSource: EventSource!
let url = URL(string: "https://localhost")!
private var eventSource: EventSource!
private var url: URL!

override func setUp() {
super.setUp()

url = URL(string: "https://localhost")!
eventSource = EventSource(url: url, headers: ["header": "value"])
}

override func tearDown() {
eventSource = nil
url = nil
super.tearDown()
}

func testCreation() {
XCTAssertEqual(url, eventSource.url)
XCTAssertEqual(eventSource.headers, ["header": "value"])
Expand Down
2 changes: 1 addition & 1 deletion EventSourceTests/EventStreamParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit
import XCTest
@testable import EventSource

class EventStreamParserTests: XCTestCase {
final class EventStreamParserTests: XCTestCase {

func testExtractingEvents() {
let eventParser = EventStreamParser()
Expand Down
6 changes: 4 additions & 2 deletions EventSourceTests/EventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import UIKit
import XCTest
@testable import EventSource

class EventTests: XCTestCase {
let newLineCharacters = ["\r\n", "\n", "\r"]
final class EventTests: XCTestCase {
private var newLineCharacters: [String] {
["\r\n", "\n", "\r"]
}

func testIgnoreComment() {
var event = Event(eventString: ":retry", newLineCharacters: newLineCharacters)
Expand Down
2 changes: 1 addition & 1 deletion EventSourceTests/Mock/URLSessionDataTaskMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

class URLSessionDataTaskMock: URLSessionDataTask {
final class URLSessionDataTaskMock: URLSessionDataTask {

let mockResponse: URLResponse?

Expand Down