react-native-navigation的迁移库

RNNExternalComponentStoreTest.m 844B

12345678910111213141516171819202122232425262728293031323334
  1. #import <XCTest/XCTest.h>
  2. #import <OCMock/OCMock.h>
  3. #import "RNNExternalComponentStore.h"
  4. @interface RNNExternalComponentStoreTest : XCTestCase
  5. @property (nonatomic, strong) RNNExternalComponentStore *store;
  6. @end
  7. @implementation RNNExternalComponentStoreTest
  8. - (void)setUp {
  9. [super setUp];
  10. self.store = [RNNExternalComponentStore new];
  11. }
  12. - (void)testGetExternalComponentShouldRetrunSavedComponent {
  13. UIViewController* testVC = [UIViewController new];
  14. RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] init];
  15. layoutInfo.name = @"extId1";
  16. [self.store registerExternalComponent:layoutInfo.name callback:^UIViewController *(NSDictionary *props, RCTBridge *bridge) {
  17. return testVC;
  18. }];
  19. UIViewController* savedComponent = [self.store getExternalComponent:layoutInfo bridge:nil];
  20. XCTAssertEqual(testVC, savedComponent);
  21. }
  22. @end