remove old stuff. change test name
This commit is contained in:
parent
66674aae78
commit
17fb142083
@ -39,8 +39,6 @@
|
||||
5764DFA21B51F254004FF46E /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF881B51F254004FF46E /* WebSocket.swift */; };
|
||||
741F39EE1BD025D80026C9CC /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
741F39EF1BD025D80026C9CC /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
741F39F11BD026310026C9CC /* SocketTestSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39F01BD026310026C9CC /* SocketTestSocket.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
741F39F21BD026310026C9CC /* SocketTestSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39F01BD026310026C9CC /* SocketTestSocket.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
745895381BB59A0A0050ACC8 /* SocketAckManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94A20D601B99E22F00BF9E44 /* SocketAckManagerTest.swift */; };
|
||||
7458953D1BB59A0A0050ACC8 /* SocketParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 949FAE8C1B9B94E600073BE9 /* SocketParserTest.swift */; };
|
||||
7472A5E11BB6ECE800CD4F59 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7C1B51F254004FF46E /* SocketAckManager.swift */; };
|
||||
@ -80,8 +78,6 @@
|
||||
74F124E91BC56BFC002966F4 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124E71BC56BFC002966F4 /* SocketEnginePacketType.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
74F124EA1BC56BFC002966F4 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124E71BC56BFC002966F4 /* SocketEnginePacketType.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
74F124EB1BC56BFC002966F4 /* SocketEnginePacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124E71BC56BFC002966F4 /* SocketEnginePacketType.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
74F124ED1BC572A8002966F4 /* SocketTestEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EC1BC572A8002966F4 /* SocketTestEngine.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
74F124EE1BC572A8002966F4 /* SocketTestEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EC1BC572A8002966F4 /* SocketTestEngine.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
74F124F01BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
74F124F11BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */; settings = {ASSET_TAGS = (); }; };
|
||||
945B65351B5FCEEA0081E995 /* SocketAckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5764DF7C1B51F254004FF46E /* SocketAckManager.swift */; };
|
||||
@ -143,7 +139,6 @@
|
||||
5764DF871B51F254004FF46E /* SwiftRegex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftRegex.swift; path = SocketIOClientSwift/SwiftRegex.swift; sourceTree = "<group>"; };
|
||||
5764DF881B51F254004FF46E /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebSocket.swift; path = SocketIOClientSwift/WebSocket.swift; sourceTree = "<group>"; };
|
||||
741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketEngineTest.swift; sourceTree = "<group>"; };
|
||||
741F39F01BD026310026C9CC /* SocketTestSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketTestSocket.swift; sourceTree = "<group>"; };
|
||||
7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketNamespacePacketTest.swift; sourceTree = "<group>"; };
|
||||
7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketSideEffectTest.swift; sourceTree = "<group>"; };
|
||||
74781D591B7E83930042CACA /* SocketIOClientStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketIOClientStatus.swift; path = SocketIOClientSwift/SocketIOClientStatus.swift; sourceTree = "<group>"; };
|
||||
@ -151,7 +146,6 @@
|
||||
74D765611B9F0D870028551C /* SocketStringReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SocketStringReader.swift; path = SocketIOClientSwift/SocketStringReader.swift; sourceTree = "<group>"; };
|
||||
74F124E21BC5697B002966F4 /* SocketEngineSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketEngineSpec.swift; path = SocketIOClientSwift/SocketEngineSpec.swift; sourceTree = "<group>"; };
|
||||
74F124E71BC56BFC002966F4 /* SocketEnginePacketType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketEnginePacketType.swift; path = SocketIOClientSwift/SocketEnginePacketType.swift; sourceTree = "<group>"; };
|
||||
74F124EC1BC572A8002966F4 /* SocketTestEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketTestEngine.swift; sourceTree = "<group>"; };
|
||||
74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketBasicPacketTest.swift; sourceTree = "<group>"; };
|
||||
949FAE8C1B9B94E600073BE9 /* SocketParserTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketParserTest.swift; path = "../SocketIO-iOSTests/SocketParserTest.swift"; sourceTree = "<group>"; };
|
||||
94A20D601B99E22F00BF9E44 /* SocketAckManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketAckManagerTest.swift; path = "../SocketIO-iOSTests/SocketAckManagerTest.swift"; sourceTree = "<group>"; };
|
||||
@ -273,8 +267,6 @@
|
||||
7472C65B1BCAB53E003CA70D /* SocketNamespacePacketTest.swift */,
|
||||
949FAE8C1B9B94E600073BE9 /* SocketParserTest.swift */,
|
||||
7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */,
|
||||
74F124EC1BC572A8002966F4 /* SocketTestEngine.swift */,
|
||||
741F39F01BD026310026C9CC /* SocketTestSocket.swift */,
|
||||
572EF2471B51F18A00EEBB58 /* Supporting Files */,
|
||||
);
|
||||
path = "SocketIO-MacTests";
|
||||
@ -517,7 +509,6 @@
|
||||
945B653A1B5FCEEA0081E995 /* SocketFixUTF8.swift in Sources */,
|
||||
945B65391B5FCEEA0081E995 /* SocketEventHandler.swift in Sources */,
|
||||
749A7F8C1BA9D42D00782993 /* SocketAckEmitter.swift in Sources */,
|
||||
74F124ED1BC572A8002966F4 /* SocketTestEngine.swift in Sources */,
|
||||
945B65371B5FCEEA0081E995 /* SocketEngine.swift in Sources */,
|
||||
7472C65F1BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */,
|
||||
945B65351B5FCEEA0081E995 /* SocketAckManager.swift in Sources */,
|
||||
@ -532,7 +523,6 @@
|
||||
74781D5B1B7E83930042CACA /* SocketIOClientStatus.swift in Sources */,
|
||||
945B653B1B5FCEEA0081E995 /* SocketIOClient.swift in Sources */,
|
||||
74F124F01BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */,
|
||||
741F39F11BD026310026C9CC /* SocketTestSocket.swift in Sources */,
|
||||
949FAE8D1B9B94E600073BE9 /* SocketParserTest.swift in Sources */,
|
||||
7472C65C1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */,
|
||||
945B65411B5FCEEA0081E995 /* WebSocket.swift in Sources */,
|
||||
@ -575,7 +565,6 @@
|
||||
7472A5E31BB6ECE800CD4F59 /* SocketEngine.swift in Sources */,
|
||||
7472A5E41BB6ECE800CD4F59 /* SocketEngineClient.swift in Sources */,
|
||||
7472A5E51BB6ECE800CD4F59 /* SocketEventHandler.swift in Sources */,
|
||||
74F124EE1BC572A8002966F4 /* SocketTestEngine.swift in Sources */,
|
||||
7472A5E61BB6ECE800CD4F59 /* SocketFixUTF8.swift in Sources */,
|
||||
7472C6601BCAC46E003CA70D /* SocketSideEffectTest.swift in Sources */,
|
||||
7472A5E71BB6ECE800CD4F59 /* SocketIOClient.swift in Sources */,
|
||||
@ -590,7 +579,6 @@
|
||||
745895381BB59A0A0050ACC8 /* SocketAckManagerTest.swift in Sources */,
|
||||
7458953D1BB59A0A0050ACC8 /* SocketParserTest.swift in Sources */,
|
||||
74F124F11BC574CF002966F4 /* SocketBasicPacketTest.swift in Sources */,
|
||||
741F39F21BD026310026C9CC /* SocketTestSocket.swift in Sources */,
|
||||
74F124EB1BC56BFC002966F4 /* SocketEnginePacketType.swift in Sources */,
|
||||
7472C65D1BCAB53E003CA70D /* SocketNamespacePacketTest.swift in Sources */,
|
||||
749A7F901BA9D42D00782993 /* SocketAckEmitter.swift in Sources */,
|
||||
|
||||
@ -30,7 +30,7 @@ class SocketEngineTest: XCTestCase {
|
||||
waitForExpectationsWithTimeout(3, handler: nil)
|
||||
}
|
||||
|
||||
func twoPacketsInOnePollTest() {
|
||||
func testTwoPacketsInOnePollTest() {
|
||||
let finalExpectation = expectationWithDescription("Final packet in poll test")
|
||||
var gotBlank = false
|
||||
|
||||
@ -40,13 +40,13 @@ class SocketEngineTest: XCTestCase {
|
||||
|
||||
client.on("stringTest") {data, ack in
|
||||
if let str = data[0] as? String where gotBlank {
|
||||
if str == "line one\nline two" {
|
||||
if str == "hello" {
|
||||
finalExpectation.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
engine.parsePollingMessage("15:42[\"blankTest\"]37:42[\"stringTest\",\"line one\nline two\"]")
|
||||
engine.parsePollingMessage("15:42[\"blankTest\"]24:42[\"stringTest\",\"hello\"]")
|
||||
waitForExpectationsWithTimeout(3, handler: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
//
|
||||
// SocketTestEngine.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/7/15.
|
||||
//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
// Test engine used to test SocketIOClient
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class SocketTestEngine: NSObject, SocketEngineSpec {
|
||||
private let expectedNumberOfBinary: Int
|
||||
private let expectedSendString: String
|
||||
private var expectedBinary: [NSData]?
|
||||
private var binary: [NSData]?
|
||||
private var sendString = ""
|
||||
private var numOfBinary = -1
|
||||
|
||||
private(set) var sid = ""
|
||||
private(set) var cookies: [NSHTTPCookie]?
|
||||
private(set) var socketPath = ""
|
||||
private(set) var urlPolling = ""
|
||||
private(set) var urlWebSocket = ""
|
||||
private(set) var ws: WebSocket?
|
||||
|
||||
weak var client: SocketEngineClient?
|
||||
var expectation: XCTestExpectation?
|
||||
|
||||
init(client: SocketIOClient, expectedSendString: String, expectedNumberOfBinary: Int, expectedBinary: [NSData]?) {
|
||||
self.client = client
|
||||
self.expectedSendString = expectedSendString
|
||||
self.expectedNumberOfBinary = expectedNumberOfBinary
|
||||
self.expectedBinary = expectedBinary
|
||||
}
|
||||
|
||||
required init(client: SocketEngineClient, sessionDelegate: NSURLSessionDelegate?) {
|
||||
expectedSendString = ""
|
||||
expectedNumberOfBinary = 0
|
||||
}
|
||||
|
||||
required init(client: SocketEngineClient, opts: NSDictionary?) {
|
||||
expectedSendString = ""
|
||||
expectedNumberOfBinary = 0
|
||||
}
|
||||
|
||||
func close(fast fast: Bool) {}
|
||||
func open(opts: [String: AnyObject]?) {}
|
||||
|
||||
func send(msg: String, withData datas: [NSData]?) {
|
||||
sendString = msg
|
||||
numOfBinary = datas?.count ?? 0
|
||||
binary = datas
|
||||
}
|
||||
|
||||
func socketDidCorrectlyCreatePacket() -> Bool {
|
||||
if expectedNumberOfBinary == numOfBinary
|
||||
&& sendString == expectedSendString
|
||||
&& expectedBinary ?? [] == binary ?? [] {
|
||||
expectation?.fulfill()
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func write(msg: String, withType type: SocketEnginePacketType, withData data: [NSData]?) {}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
//
|
||||
// SocketTestSocket.swift
|
||||
// Socket.IO-Client-Swift
|
||||
//
|
||||
// Created by Erik Little on 10/15/15.
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class SocketTestSocket: NSObject, SocketEngineClient {
|
||||
private let expectedStrings: [String]
|
||||
private let expectedNumberOfBinary: Int
|
||||
private let expectedBinary: [NSData]?
|
||||
|
||||
var actualStrings = [String]()
|
||||
var binary = [NSData]()
|
||||
|
||||
var socketURL = ""
|
||||
var secure = false
|
||||
|
||||
init(expectedStrings: [String], expectedNumberOfBinary: Int, expectedBinary: [NSData]?) {
|
||||
self.expectedStrings = expectedStrings
|
||||
self.expectedNumberOfBinary = expectedNumberOfBinary
|
||||
self.expectedBinary = expectedBinary
|
||||
}
|
||||
|
||||
func didError(reason: AnyObject) {}
|
||||
|
||||
func engineDidClose(reason: String) {}
|
||||
|
||||
func parseSocketMessage(msg: String) {
|
||||
actualStrings.append(msg)
|
||||
}
|
||||
|
||||
func parseBinaryData(data: NSData) {
|
||||
binary.append(data)
|
||||
}
|
||||
|
||||
func isCorrectPackets() -> Bool {
|
||||
return expectedBinary ?? [] == binary && expectedStrings == actualStrings
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user