@@ -130,39 +130,6 @@ class HandlingIncomingEventsTests: XCTestCase {
130
130
waitForExpectations ( timeout: 0.5 )
131
131
}
132
132
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
-
166
133
func testReturningAJSONObjectToCallbacksIfTheStringCanBeParsed( ) {
167
134
let ex = expectation ( description: " Callback should be called " )
168
135
@@ -231,29 +198,6 @@ class HandlingIncomingEventsTests: XCTestCase {
231
198
waitForExpectations ( timeout: 0.5 )
232
199
}
233
200
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
-
257
201
func testEventObjectReturnedToChannelCallback( ) {
258
202
let ex = expectation ( description: " Callback should be called " )
259
203
0 commit comments