Skip to content

Commit 8166689

Browse files
committed
unit test for button icon parsing
1 parent 3b84b0e commit 8166689

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

iOS_SDK/OneSignalSDK/UnitTests/UnitTests.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,50 @@ - (void)testDeviceStateJson {
31133113
XCTAssertEqualObjects(json[@"isSMSSubscribed"], @1);
31143114
}
31153115

3116+
- (void)testParseNotificationSystemActionIconJson {
3117+
NSDictionary *aps = @{
3118+
@"aps": @{
3119+
@"content-available": @1,
3120+
@"mutable-content": @1,
3121+
@"alert": @"Message Body",
3122+
},
3123+
@"os_data": @{
3124+
@"i": @"notif id",
3125+
@"ti": @"templateId123",
3126+
@"tn": @"Template name",
3127+
@"buttons": @[@{
3128+
@"i": @"id1",
3129+
@"n": @"text1",
3130+
@"path": @"hand.thumbsup",
3131+
@"icon_type": @"system"
3132+
}]
3133+
}};
3134+
OSNotification *notification = [OSNotification parseWithApns:aps];
3135+
XCTAssertEqualObjects(notification.actionButtons[0][@"systemIcon"], @"hand.thumbsup");
3136+
}
3137+
3138+
- (void)testParseNotificationTemplateActionIconJson {
3139+
NSDictionary *aps = @{
3140+
@"aps": @{
3141+
@"content-available": @1,
3142+
@"mutable-content": @1,
3143+
@"alert": @"Message Body",
3144+
},
3145+
@"os_data": @{
3146+
@"i": @"notif id",
3147+
@"ti": @"templateId123",
3148+
@"tn": @"Template name",
3149+
@"buttons": @[@{
3150+
@"i": @"id1",
3151+
@"n": @"text1",
3152+
@"path": @"myImage/thumbsup",
3153+
@"icon_type": @"template"
3154+
}]
3155+
}};
3156+
OSNotification *notification = [OSNotification parseWithApns:aps];
3157+
XCTAssertEqualObjects(notification.actionButtons[0][@"templateIcon"], @"myImage/thumbsup");
3158+
}
3159+
31163160
- (void)testNotificationJson {
31173161
NSDictionary *aps = @{
31183162
@"aps": @{

0 commit comments

Comments
 (0)