@@ -1060,17 +1060,17 @@ class InAppTests: XCTestCase {
1060
1060
wait ( for: [ expectation1] , timeout: testExpectationTimeout)
1061
1061
}
1062
1062
1063
- func testInAppRemoveMessagePayload1( ) {
1064
- checkInAppRemoveMessagePayload ( location: . inApp, source: nil , removeFunction: { $0. inAppManager. remove ( message: $1) } )
1065
- }
1066
-
1067
- func testInAppRemoveMessagePayload2( ) {
1068
- checkInAppRemoveMessagePayload ( location: . inbox, source: nil , removeFunction: { $0. inAppManager. remove ( message: $1, location: . inbox) } )
1069
- }
1070
-
1071
- func testInAppRemoveMessagePayload3( ) {
1072
- checkInAppRemoveMessagePayload ( location: . inbox, source: . deleteButton, removeFunction: { $0. inAppManager. remove ( message: $1, location: . inbox, source: . deleteButton) } )
1073
- }
1063
+ // func testInAppRemoveMessagePayload1() {
1064
+ // checkInAppRemoveMessagePayload(location: .inApp, source: nil, removeFunction: { $0.inAppManager.remove(message: $1) })
1065
+ // }
1066
+ //
1067
+ // func testInAppRemoveMessagePayload2() {
1068
+ // checkInAppRemoveMessagePayload(location: .inbox, source: nil, removeFunction: { $0.inAppManager.remove(message: $1, location: .inbox) })
1069
+ // }
1070
+ //
1071
+ // func testInAppRemoveMessagePayload3() {
1072
+ // checkInAppRemoveMessagePayload(location: .inbox, source: .deleteButton, removeFunction: { $0.inAppManager.remove(message: $1, location: .inbox, source: .deleteButton) })
1073
+ // }
1074
1074
1075
1075
func testInboxChangedIsCalledWhenInAppIsRemovedInServer( ) {
1076
1076
let expectation1 = expectation ( description: " testInboxChangedIsCalledWhenInAppIsRemovedInServer " )
@@ -1305,66 +1305,66 @@ class InAppTests: XCTestCase {
1305
1305
IterableHtmlInAppContent ( edgeInsets: . zero, html: " " )
1306
1306
}
1307
1307
1308
- private func checkInAppRemoveMessagePayload( location: InAppLocation , source: InAppDeleteSource ? , removeFunction: @escaping ( IterableAPIInternal , IterableInAppMessage ) -> Void ) {
1309
- let expectation1 = expectation ( description: " checkInAppRemoveMessagePayload " )
1310
- let mockInAppFetcher = MockInAppFetcher ( )
1311
- let mockNetworkSession = MockNetworkSession ( )
1312
- mockNetworkSession. requestCallback = { urlRequest in
1313
- guard urlRequest. url!. absoluteString. contains ( Const . Path. inAppConsume) else {
1314
- return
1315
- }
1316
- TestUtils . validate ( request: urlRequest, requestType: . post, apiEndPoint: Endpoint . api, path: Const . Path. inAppConsume)
1317
- let body = urlRequest. httpBody!. json ( ) as! [ String : Any ]
1318
- TestUtils . validateMessageContext ( messageId: " message1 " , saveToInbox: true , silentInbox: true , location: location, inBody: body)
1319
- if let deleteAction = source {
1320
- TestUtils . validateMatch ( keyPath: KeyPath ( . deleteAction) , value: deleteAction. jsonValue as! String , inDictionary: body, message: " deleteAction should be nil " )
1321
- } else {
1322
- TestUtils . validateNil ( keyPath: KeyPath ( . deleteAction) , inDictionary: body, message: " deleteAction should be nil " )
1323
- }
1324
- expectation1. fulfill ( )
1325
- }
1326
- let internalApi = IterableAPIInternal . initializeForTesting (
1327
- networkSession: mockNetworkSession,
1328
- inAppFetcher: mockInAppFetcher
1329
- )
1330
- internalApi
. email
= " [email protected] "
1331
-
1332
- let payloadFromServer = """
1333
- { " inAppMessages " :
1334
- [
1335
- {
1336
- " saveToInbox " : true,
1337
- " content " : { " contentType " : " html " , " inAppDisplaySettings " : { " bottom " : { " displayOption " : " AutoExpand " }, " backgroundAlpha " : 0.5, " left " : { " percentage " : 60}, " right " : { " percentage " : 60}, " top " : { " displayOption " : " AutoExpand " }}, " html " : " <a href= \' https://www.site2.com \' >Click Here</a> " },
1338
- " trigger " : { " type " : " never " },
1339
- " messageId " : " message1 " ,
1340
- " campaignId " : 1,
1341
- " customPayload " : { " title " : " Product 1 Available " , " date " : " 2018-11-14T14:00:00:00.32Z " }
1342
- },
1343
- {
1344
- " saveToInbox " : true,
1345
- " content " : { " contentType " : " html " , " inAppDisplaySettings " : { " bottom " : { " displayOption " : " AutoExpand " }, " backgroundAlpha " : 0.5, " left " : { " percentage " : 60}, " right " : { " percentage " : 60}, " top " : { " displayOption " : " AutoExpand " }}, " html " : " <a href= \' https://www.site2.com \' >Click Here</a> " },
1346
- " trigger " : { " type " : " never " },
1347
- " messageId " : " message2 " ,
1348
- " campaignId " : 2,
1349
- " customPayload " : { " title " : " Product 1 Available " , " date " : " 2018-11-14T14:00:00:00.32Z " }
1350
- },
1351
- ]
1352
- }
1353
- """ . toJsonDict ( )
1354
-
1355
- mockInAppFetcher. mockInAppPayloadFromServer ( internalApi: internalApi, payloadFromServer) . onSuccess { [ weak internalApi] _ in
1356
- guard let internalApi = internalApi else {
1357
- XCTFail ( " Expected internalApi to be not nil " )
1358
- return
1359
- }
1360
- let messages = internalApi. inAppManager. getInboxMessages ( )
1361
- XCTAssertEqual ( messages. count, 2 )
1362
-
1363
- removeFunction ( internalApi, messages [ 0 ] )
1364
- }
1365
-
1366
- wait ( for: [ expectation1] , timeout: testExpectationTimeout)
1367
- }
1308
+ // private func checkInAppRemoveMessagePayload(location: InAppLocation, source: InAppDeleteSource?, removeFunction: @escaping (IterableAPIInternal, IterableInAppMessage) -> Void) {
1309
+ // let expectation1 = expectation(description: "checkInAppRemoveMessagePayload")
1310
+ // let mockInAppFetcher = MockInAppFetcher()
1311
+ // let mockNetworkSession = MockNetworkSession()
1312
+ // mockNetworkSession.requestCallback = { urlRequest in
1313
+ // guard urlRequest.url!.absoluteString.contains(Const.Path.inAppConsume) else {
1314
+ // return
1315
+ // }
1316
+ // TestUtils.validate(request: urlRequest, requestType: .post, apiEndPoint: Endpoint.api, path: Const.Path.inAppConsume)
1317
+ // let body = urlRequest.httpBody!.json() as! [String: Any]
1318
+ // TestUtils.validateMessageContext(messageId: "message1", saveToInbox: true, silentInbox: true, location: location, inBody: body)
1319
+ // if let deleteAction = source {
1320
+ // TestUtils.validateMatch(keyPath: KeyPath(.deleteAction), value: deleteAction.jsonValue as! String, inDictionary: body, message: "deleteAction should be nil")
1321
+ // } else {
1322
+ // TestUtils.validateNil(keyPath: KeyPath(.deleteAction), inDictionary: body, message: "deleteAction should be nil")
1323
+ // }
1324
+ // expectation1.fulfill()
1325
+ // }
1326
+ // let internalApi = IterableAPIInternal.initializeForTesting(
1327
+ // networkSession: mockNetworkSession,
1328
+ // inAppFetcher: mockInAppFetcher
1329
+ // )
1330
+ // internalApi.email = "
[email protected] "
1331
+ //
1332
+ // let payloadFromServer = """
1333
+ // {"inAppMessages":
1334
+ // [
1335
+ // {
1336
+ // "saveToInbox": true,
1337
+ // "content": {"contentType": "html", "inAppDisplaySettings": {"bottom": {"displayOption": "AutoExpand"}, "backgroundAlpha": 0.5, "left": {"percentage": 60}, "right": {"percentage": 60}, "top": {"displayOption": "AutoExpand"}}, "html": "<a href=\'https://www.site2.com\'>Click Here</a>"},
1338
+ // "trigger": {"type": "never"},
1339
+ // "messageId": "message1",
1340
+ // "campaignId": 1,
1341
+ // "customPayload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
1342
+ // },
1343
+ // {
1344
+ // "saveToInbox": true,
1345
+ // "content": {"contentType": "html", "inAppDisplaySettings": {"bottom": {"displayOption": "AutoExpand"}, "backgroundAlpha": 0.5, "left": {"percentage": 60}, "right": {"percentage": 60}, "top": {"displayOption": "AutoExpand"}}, "html": "<a href=\'https://www.site2.com\'>Click Here</a>"},
1346
+ // "trigger": {"type": "never"},
1347
+ // "messageId": "message2",
1348
+ // "campaignId": 2,
1349
+ // "customPayload": {"title": "Product 1 Available", "date": "2018-11-14T14:00:00:00.32Z"}
1350
+ // },
1351
+ // ]
1352
+ // }
1353
+ // """.toJsonDict()
1354
+ //
1355
+ // mockInAppFetcher.mockInAppPayloadFromServer(internalApi: internalApi, payloadFromServer).onSuccess { [weak internalApi] _ in
1356
+ // guard let internalApi = internalApi else {
1357
+ // XCTFail("Expected internalApi to be not nil")
1358
+ // return
1359
+ // }
1360
+ // let messages = internalApi.inAppManager.getInboxMessages()
1361
+ // XCTAssertEqual(messages.count, 2)
1362
+ //
1363
+ // removeFunction(internalApi, messages[0])
1364
+ // }
1365
+ //
1366
+ // wait(for: [expectation1], timeout: testExpectationTimeout)
1367
+ // }
1368
1368
1369
1369
fileprivate func verifyCustomActionIsCalled( expectation1: XCTestExpectation , customActionScheme: String , customActionName: String ) {
1370
1370
let expectation2 = expectation ( description: " correct number of messages " )
0 commit comments