Skip to content

Commit

Permalink
Try multiple instances of the server
Browse files Browse the repository at this point in the history
  • Loading branch information
joemasilotti committed Nov 9, 2023
1 parent 465e784 commit e0b4bf0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Tests/SessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ private let defaultTimeout: TimeInterval = 10
private let turboTimeout: TimeInterval = 30

class SessionTests: XCTestCase {
private static let server = HttpServer()
private let server = HttpServer()

private let sessionDelegate = TestSessionDelegate()
private var session: Session!

override class func setUp() {
override func setUp() {
startServer()
}

override class func tearDown() {
server.stop()
}

override func setUp() {
let configuration = WKWebViewConfiguration()
configuration.applicationNameForUserAgent = "Turbo iOS Test/1.0"

Expand All @@ -30,6 +24,8 @@ class SessionTests: XCTestCase {

override func tearDown() {
session.webView.configuration.userContentController.removeScriptMessageHandler(forName: "turbo")

server.stop()
}

func test_init_initializesWebViewWithConfiguration() {
Expand Down Expand Up @@ -141,7 +137,7 @@ class SessionTests: XCTestCase {
return baseURL.appendingPathComponent(relativePath)
}

private static func startServer() {
private func startServer() {
server["/turbo-7.0.0-beta.1.js"] = { _ in
let fileURL = Bundle.module.url(forResource: "turbo-7.0.0-beta.1", withExtension: "js", subdirectory: "Server")!
let data = try! Data(contentsOf: fileURL)
Expand Down

0 comments on commit e0b4bf0

Please sign in to comment.