react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // RNNStoreTest.m
  3. // playground
  4. //
  5. // Created by Ran Greenberg on 12/02/2017.
  6. // Copyright © 2017 Wix. All rights reserved.
  7. //
  8. #import <XCTest/XCTest.h>
  9. #import "RNNStore.m"
  10. @interface RNNStoreTest : XCTestCase
  11. @property (nonatomic, strong) RNNStore *store;
  12. @end
  13. @implementation RNNStoreTest
  14. - (void)setUp {
  15. [super setUp];
  16. self.store = [RNNStore new];
  17. }
  18. - (void)testFindContainerForId_setAndGetsimpleContainerId {
  19. NSString *containerId1 = @"cntId1";
  20. NSString *containerId2 = @"cntId2";
  21. UIViewController *vc1 = [UIViewController new];
  22. UIViewController *vc2 = [UIViewController new];
  23. [self.store setContainer:vc1 containerId:containerId1];
  24. [self.store setContainer:vc2 containerId:containerId2];
  25. UIViewController *ans = [self.store findContainerForId:containerId1];
  26. XCTAssertEqualObjects(vc1, ans);
  27. XCTAssertNotEqualObjects(vc2, ans);
  28. }
  29. - (void)testFindContainerForId_setNilContainerId {
  30. NSString *containerId1 = nil;
  31. UIViewController *vc1 = [UIViewController new];
  32. [self.store setContainer:vc1 containerId:containerId1];
  33. UIViewController *ans = [self.store findContainerForId:containerId1];
  34. XCTAssertNil(ans);
  35. }
  36. - (void)testFindContainerForId_setDoubleContainerId {
  37. NSString *containerId1 = @"cntId1";
  38. UIViewController *vc1 = [UIViewController new];
  39. UIViewController *vc2 = [UIViewController new];
  40. [self.store setContainer:vc1 containerId:containerId1];
  41. UIViewController *ans = [self.store findContainerForId:containerId1];
  42. XCTAssertEqualObjects(vc1, ans);
  43. XCTAssertThrows([self.store setContainer:vc2 containerId:containerId1]);
  44. }
  45. @end