Skip to content

Commit 69b0062

Browse files
committed
feat: add test testConnectedAlready
1 parent 07a6029 commit 69b0062

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: Tests/TestSocketIO/SocketSideEffectTest.swift

+15
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,21 @@ class SocketSideEffectTest: XCTestCase {
355355
waitForExpectations(timeout: 2)
356356
}
357357

358+
func testConnectedAlready() {
359+
let expect = expectation(description: "The client should call its handler if it's connected already")
360+
let nspString = "/swift"
361+
362+
socket.setTestStatus(.connected)
363+
socket.nsp = "/someNamespace"
364+
socket.engine = TestEngine(client: socket, url: socket.socketURL, options: nil)
365+
366+
socket.connect(timeoutAfter: 0.5, withHandler: {
367+
expect.fulfill()
368+
})
369+
370+
waitForExpectations(timeout: 0.8)
371+
}
372+
358373
func testErrorInCustomSocketDataCallsErrorHandler() {
359374
let expect = expectation(description: "The client should call the error handler for emit errors because of " +
360375
"custom data")

0 commit comments

Comments
 (0)