Skip to content

Commit c6bdf43

Browse files
committed
Merge branch 'development'
* development: more test restructuring Restructure tests Add test for socketio#829
2 parents 102251b + 45955ae commit c6bdf43

12 files changed

+111
-102
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ script:
1515
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build test -quiet
1616
# - xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build-for-testing -quiet
1717
# - xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac run-tests --parallelize
18-
- swift build
18+
- swift test

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let package = Package(
1111
.package(url: "https://github.com/daltoniam/Starscream", .upToNextMajor(from: "2.1.1")),
1212
],
1313
targets: [
14-
.target(name: "SocketIO", dependencies: ["Starscream"])
14+
.target(name: "SocketIO", dependencies: ["Starscream"]),
15+
.testTarget(name: "TestSocketIO", dependencies: ["SocketIO"]),
1516
]
1617
)

Socket.IO-Client-Swift.xcodeproj/project.pbxproj

Lines changed: 90 additions & 76 deletions
Large diffs are not rendered by default.

SocketIO-MacTests/Info.plist

Lines changed: 0 additions & 24 deletions
This file was deleted.

SocketIO-MacTests/SocketSideEffectTest.swift renamed to Tests/TestSocketIO/SocketSideEffectTest.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,24 @@ class SocketSideEffectTest: XCTestCase {
387387
XCTAssertEqual(socket.nsp, "/test", "It should set the namespace after creation")
388388
}
389389

390+
func testSettingExtraHeadersAfterInit() {
391+
socket.setTestStatus(.notConnected)
392+
socket.config = [.extraHeaders(["new": "value"])]
393+
socket.config.insert(.extraHeaders(["hello": "world"]), replacing: true)
394+
395+
for config in socket.config {
396+
switch config {
397+
case let .extraHeaders(headers):
398+
XCTAssertTrue(headers.keys.contains("hello"), "It should contain hello header key")
399+
XCTAssertFalse(headers.keys.contains("new"), "It should not contain old data")
400+
case .path:
401+
continue
402+
default:
403+
XCTFail("It should only have two configs")
404+
}
405+
}
406+
}
407+
390408
func testSettingConfigAfterInitWhenConnectedIgnoresChanges() {
391409
socket.config = [.log(true), .nsp("/test")]
392410

0 commit comments

Comments
 (0)