Skip to content

Commit

Permalink
unit test for button icon parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
emawby committed Sep 3, 2021
1 parent 506f2f9 commit 6543a06
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -3113,6 +3113,50 @@ - (void)testDeviceStateJson {
XCTAssertEqualObjects(json[@"isSMSSubscribed"], @1);
}

- (void)testParseNotificationSystemActionIconJson {
NSDictionary *aps = @{
@"aps": @{
@"content-available": @1,
@"mutable-content": @1,
@"alert": @"Message Body",
},
@"os_data": @{
@"i": @"notif id",
@"ti": @"templateId123",
@"tn": @"Template name",
@"buttons": @[@{
@"i": @"id1",
@"n": @"text1",
@"path": @"hand.thumbsup",
@"icon_type": @"system"
}]
}};
OSNotification *notification = [OSNotification parseWithApns:aps];
XCTAssertEqualObjects(notification.actionButtons[0][@"systemIcon"], @"hand.thumbsup");
}

- (void)testParseNotificationTemplateActionIconJson {
NSDictionary *aps = @{
@"aps": @{
@"content-available": @1,
@"mutable-content": @1,
@"alert": @"Message Body",
},
@"os_data": @{
@"i": @"notif id",
@"ti": @"templateId123",
@"tn": @"Template name",
@"buttons": @[@{
@"i": @"id1",
@"n": @"text1",
@"path": @"myImage/thumbsup",
@"icon_type": @"template"
}]
}};
OSNotification *notification = [OSNotification parseWithApns:aps];
XCTAssertEqualObjects(notification.actionButtons[0][@"templateIcon"], @"myImage/thumbsup");
}

- (void)testNotificationJson {
NSDictionary *aps = @{
@"aps": @{
Expand Down

0 comments on commit 6543a06

Please sign in to comment.