From 8cf658f81bc73a66a70fb9c5dd8ff68254d5bc77 Mon Sep 17 00:00:00 2001 From: yogevbd Date: Wed, 2 Oct 2019 17:38:45 +0300 Subject: [PATCH] Fix iOS unit tests --- .../RNNotificationEventHandlerTests.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/ios/RNNotificationsTests/RNNotificationEventHandlerTests.m b/lib/ios/RNNotificationsTests/RNNotificationEventHandlerTests.m index 23f11b8..919226f 100644 --- a/lib/ios/RNNotificationsTests/RNNotificationEventHandlerTests.m +++ b/lib/ios/RNNotificationsTests/RNNotificationEventHandlerTests.m @@ -70,12 +70,14 @@ - (void)testDidReceiveNotificationResponse_ShouldEmitEvent { UNNotification* notification = [self createNotificationWithIdentifier:@"id" andUserInfo:@{@"extraKey": @"extraValue"}]; - UNNotificationResponse* response = [self createNotificationResponseWithIdentifier:@"id" andNotification:notification]; + UNNotificationResponse* response = [self createNotificationResponseWithIdentifier:@"actionId" andNotification:notification]; void (^testBlock)(void) = ^void() {}; - [[_mockedNotificationCenter expect] postNotificationName:RNNotificationOpened object:[OCMArg any] userInfo:[OCMArg checkWithBlock:^BOOL(id obj) { - return ([[obj valueForKey:@"identifier"] isEqualToString:@"id"] && - [[obj valueForKey:@"extraKey"] isEqualToString:@"extraValue"]); + [[_mockedNotificationCenter expect] postNotificationName:RNNotificationOpened object:[OCMArg any] userInfo:[OCMArg checkWithBlock:^BOOL(id response) { + NSDictionary* notification = response[@"notification"]; + NSDictionary* action = response[@"action"]; + return ([[notification valueForKey:@"identifier"] isEqualToString:@"id"] && + [[notification valueForKey:@"extraKey"] isEqualToString:@"extraValue"] && [action[@"identifier"] isEqualToString:@"actionId"]); }]]; [_uut didReceiveNotificationResponse:response completionHandler:testBlock]; [_mockedNotificationCenter verify]; -- 2.26.2