@@ -304,102 +304,8 @@ class InAppHelperTests: XCTestCase {
304
304
TestUtils . validateMatch ( keyPath: KeyPath ( " myPayload.var1 " ) , value: " val1 " , inDictionary: dict, message: " Expected to find val1 " )
305
305
}
306
306
307
- // This tests payload as we are getting now
308
- func testInAppParsingWithCurrentPayload( ) {
309
- let customPayload1 = """
310
- {
311
- " contentType " : " html " ,
312
- " inAppType " : " default " ,
313
- " channelName " : " channel1 "
314
- }
315
- """
316
- let customPayload2 = """
317
- {
318
- " contentType " : " html " ,
319
- " inAppType " : " inBox " ,
320
- " channelName " : " channel2 " ,
321
- " promoteToContent " : {
322
- " title " : " title " ,
323
- " subTitle " : " subtitle " ,
324
- " imageUrl " : " http://somewhere.com/something.jpg "
325
- }
326
- }
327
- """
328
-
329
- let payload = """
330
- {
331
- " inAppMessages " : [
332
- {
333
- " content " : {
334
- " html " : " <a href= \\ " http://somewhere.com \\ " >Click here</a> " ,
335
- " payload " : \( customPayload1) ,
336
- },
337
- " messageId " : " messageIdxxx " ,
338
- " campaignId " : " campaignIdxxx " ,
339
- " trigger " : {
340
- " type " : " myNewKind " ,
341
- " myPayload " : { " var1 " : " val1 " }
342
- }
343
- },
344
- {
345
- " content " : {
346
- " html " : " <a href= \\ " http://somewhere.com \\ " >Click here</a> " ,
347
- " payload " : \( customPayload2) ,
348
- },
349
- " messageId " : " messageIdxxx " ,
350
- " campaignId " : " campaignIdxxx " ,
351
- " trigger " : {
352
- " type " : " myNewKind " ,
353
- " myPayload " : { " var1 " : " val1 " }
354
- }
355
- },
356
- {
357
- " content " : {
358
- " html " : " <a href= \\ " http://somewhere.com \\ " >Click here</a> " ,
359
- " payload " : {
360
- },
361
- },
362
- " messageId " : " messageIdxxx " ,
363
- " campaignId " : " campaignIdxxx " ,
364
- " trigger " : {
365
- " type " : " myNewKind " ,
366
- " myPayload " : { " var1 " : " val1 " }
367
- }
368
- },
369
- {
370
- " content " : {
371
- " html " : " <a href= \\ " http://somewhere.com \\ " >Click here</a> "
372
- },
373
- " messageId " : " messageIdxxx " ,
374
- " campaignId " : " campaignIdxxx " ,
375
- " trigger " : {
376
- " type " : " myNewKind " ,
377
- " myPayload " : { " var1 " : " val1 " }
378
- }
379
- }
380
- ]
381
- }
382
- """ . toJsonDict ( )
383
- let messages = InAppHelper . inAppMessages ( fromPayload: payload, internalApi: IterableAPI . internalImplementation!)
384
-
385
- XCTAssertEqual ( messages. count, 4 )
386
- let message1 = messages [ 0 ]
387
- XCTAssertEqual ( message1. channelName, " channel1 " )
388
- XCTAssertTrue ( TestUtils . areEqual ( dict1: message1. extraInfo!, dict2: customPayload1. toJsonDict ( ) ) )
389
-
390
- let message2 = messages [ 1 ]
391
- XCTAssertEqual ( message2. channelName, " channel2 " )
392
- XCTAssertTrue ( TestUtils . areEqual ( dict1: message2. extraInfo!, dict2: customPayload2. toJsonDict ( ) ) )
393
-
394
- let message3 = messages [ 2 ]
395
- XCTAssertEqual ( message3. channelName, " " )
396
-
397
- let message4 = messages [ 3 ]
398
- XCTAssertEqual ( message4. channelName, " " )
399
- }
400
-
401
307
// This tests payload as we expect to get when backend is fixed
402
- func testInAppParsingWithFuturePayload ( ) {
308
+ func testInAppPayloadParsing ( ) {
403
309
let customPayload1 = """
404
310
{
405
311
" contentType " : " html " ,
@@ -497,10 +403,10 @@ class InAppHelperTests: XCTestCase {
497
403
" content " : [
498
404
" html " : " <a href='href1'>Click Here</a> " ,
499
405
" inAppDisplaySettings " : [ " backgroundAlpha " : 0.5 , " left " : [ " percentage " : 60 ] , " right " : [ " percentage " : 60 ] , " bottom " : [ " displayOption " : " AutoExpand " ] , " top " : [ " displayOption " : " AutoExpand " ] ] ,
500
- " payload " : extraInfo
501
406
] ,
502
407
" messageId " : " messageIdxxx " ,
503
408
" campaignId " : " campaignIdxxx " ,
409
+ " customPayload " : extraInfo
504
410
] ]
505
411
]
506
412
}
0 commit comments