react-native-navigation的迁移库

UIViewController+RNNOptionsTest.m 1017B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #import <XCTest/XCTest.h>
  2. #import "UIViewController+RNNOptions.h"
  3. @interface UIViewController_RNNOptionsTest : XCTestCase
  4. @property (nonatomic, retain) UIViewController* uut;
  5. @end
  6. @implementation UIViewController_RNNOptionsTest
  7. - (void)setUp {
  8. [super setUp];
  9. self.uut = [UIViewController new];
  10. }
  11. - (void)test_setTabBarItemBadge_shouldSetValidValue {
  12. NSString* badgeValue = @"badge";
  13. [self.uut rnn_setTabBarItemBadge:badgeValue];
  14. XCTAssertEqual(self.uut.tabBarItem.badgeValue, badgeValue);
  15. }
  16. - (void)test_setTabBarItemBadge_shouldResetWhenValueIsEmptyString {
  17. [self.uut rnn_setTabBarItemBadge:@"badge"];
  18. NSString* badgeValue = @"";
  19. [self.uut rnn_setTabBarItemBadge:badgeValue];
  20. XCTAssertEqual(self.uut.tabBarItem.badgeValue, nil);
  21. }
  22. - (void)test_setTabBarItemBadge_shouldResetWhenValueIsNullObject {
  23. [self.uut rnn_setTabBarItemBadge:@"badge"];
  24. NSNull* nullBadgeValue = [NSNull new];
  25. [self.uut rnn_setTabBarItemBadge:nullBadgeValue];
  26. XCTAssertEqual(self.uut.tabBarItem.badgeValue, nil);
  27. }
  28. @end