Skip to content

Commit 6fab112

Browse files
committed
Remove redundant tests
- Since 'handleError(…)' on 'PusherConnection' no longer processes legacy global event callbacks, these tests are no longer relevant
1 parent dbd23a3 commit 6fab112

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

Tests/Integration/PusherIncomingEventHandlingTests.swift

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -130,39 +130,6 @@ class HandlingIncomingEventsTests: XCTestCase {
130130
waitForExpectations(timeout: 0.5)
131131
}
132132

133-
func testGlobalCallbackReturnsErrorData() {
134-
let ex = expectation(description: "Callback should be called")
135-
136-
let callback = { (eventData: Any?) -> Void in
137-
guard let event = eventData as? [String: AnyObject] else {
138-
return XCTFail("Event not received")
139-
}
140-
141-
guard let eventName = event["event"] as? String else {
142-
return XCTFail("No event name in event")
143-
}
144-
XCTAssertEqual(eventName, "pusher:error")
145-
146-
guard let data = event["data"] as? [String: String] else {
147-
return XCTFail("No data in event")
148-
}
149-
XCTAssertEqual(data, ["code": "<null>", "message": "Existing subscription to channel my-channel"] as [String: String])
150-
ex.fulfill()
151-
}
152-
_ = pusher.bind(callback)
153-
154-
let jsonDict = """
155-
{
156-
"event": "pusher:error",
157-
"channel": "my-channel",
158-
"data": {"code": "<null>", "message": "Existing subscription to channel my-channel"}
159-
}
160-
""".removing(.newlines)
161-
pusher.connection.webSocketDidReceiveMessage(connection: socket, string: jsonDict)
162-
163-
waitForExpectations(timeout: 0.5)
164-
}
165-
166133
func testReturningAJSONObjectToCallbacksIfTheStringCanBeParsed() {
167134
let ex = expectation(description: "Callback should be called")
168135

@@ -231,29 +198,6 @@ class HandlingIncomingEventsTests: XCTestCase {
231198
waitForExpectations(timeout: 0.5)
232199
}
233200

234-
func testReceivingAnErrorWhereTheDataPartOfTheMessageIsNotDoubleEncodedViaDataCallback() {
235-
let ex = expectation(description: "Callback should be called")
236-
237-
_ = pusher.bind({ (message: Any?) in
238-
guard let message = message as? [String: AnyObject],
239-
let eventName = message["event"] as? String,
240-
eventName == "pusher:error",
241-
let data = message["data"] as? [String: AnyObject],
242-
let errorMessage = data["message"] as? String else {
243-
return
244-
}
245-
246-
XCTAssertEqual(errorMessage, "Existing subscription to channel my-channel")
247-
ex.fulfill()
248-
})
249-
// pretend that we tried to subscribe to my-channel twice and got this error
250-
// back from Pusher
251-
let payload = "{\"event\":\"pusher:error\", \"data\":{\"message\":\"Existing subscription to channel my-channel\"}}"
252-
pusher.connection.webSocketDidReceiveMessage(connection: socket, string: payload)
253-
254-
waitForExpectations(timeout: 0.5)
255-
}
256-
257201
func testEventObjectReturnedToChannelCallback() {
258202
let ex = expectation(description: "Callback should be called")
259203

0 commit comments

Comments
 (0)