react-native-navigation的迁移库

RNNCommandsHandlerTest.m 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. #import <XCTest/XCTest.h>
  2. #import <objc/runtime.h>
  3. #import <ReactNativeNavigation/RNNCommandsHandler.h>
  4. #import <ReactNativeNavigation/RNNNavigationOptions.h>
  5. #import "RNNTestRootViewCreator.h"
  6. #import <ReactNativeNavigation/RNNComponentViewController.h>
  7. #import <ReactNativeNavigation/RNNStackController.h>
  8. #import <ReactNativeNavigation/RNNErrorHandler.h>
  9. #import <OCMock/OCMock.h>
  10. #import "RNNLayoutManager.h"
  11. #import "RNNBottomTabsController.h"
  12. #import "BottomTabsAttachModeFactory.h"
  13. @interface MockUIApplication : NSObject
  14. -(UIWindow *)keyWindow;
  15. @end
  16. @implementation MockUIApplication
  17. - (UIWindow *)keyWindow {
  18. return [UIWindow new];
  19. }
  20. @end
  21. @interface MockUINavigationController : RNNStackController
  22. @property (nonatomic, strong) NSArray* willReturnVCs;
  23. @end
  24. @implementation MockUINavigationController
  25. -(NSArray<UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated {
  26. return self.willReturnVCs;
  27. }
  28. -(NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
  29. return self.willReturnVCs;
  30. }
  31. @end
  32. @interface RNNCommandsHandlerTest : XCTestCase
  33. @property (nonatomic, strong) RNNCommandsHandler* uut;
  34. @property (nonatomic, strong) id modalManager;
  35. @property (nonatomic, strong) RNNComponentViewController* vc1;
  36. @property (nonatomic, strong) RNNComponentViewController* vc2;
  37. @property (nonatomic, strong) RNNComponentViewController* vc3;
  38. @property (nonatomic, strong) MockUINavigationController* nvc;
  39. @property (nonatomic, strong) id mainWindow;
  40. @property (nonatomic, strong) id sharedApplication;
  41. @property (nonatomic, strong) id controllerFactory;
  42. @property (nonatomic, strong) id overlayManager;
  43. @property (nonatomic, strong) id eventEmmiter;
  44. @property (nonatomic, strong) id creator;
  45. @end
  46. @implementation RNNCommandsHandlerTest
  47. - (void)setUp {
  48. [super setUp];
  49. self.creator = [OCMockObject partialMockForObject:[RNNTestRootViewCreator new]];
  50. self.mainWindow = [OCMockObject partialMockForObject:[UIWindow new]];
  51. self.eventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
  52. self.overlayManager = [OCMockObject partialMockForObject:[RNNOverlayManager new]];
  53. self.modalManager = [OCMockObject partialMockForObject:[RNNModalManager new]];
  54. self.controllerFactory = [OCMockObject partialMockForObject:[[RNNControllerFactory alloc] initWithRootViewCreator:nil eventEmitter:self.eventEmmiter store:nil componentRegistry:nil andBridge:nil bottomTabsAttachModeFactory:[BottomTabsAttachModeFactory new]]];
  55. self.uut = [[RNNCommandsHandler alloc] initWithControllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:self.modalManager overlayManager:self.overlayManager mainWindow:_mainWindow];
  56. self.vc1 = [self generateComponentWithComponentId:@"1"];
  57. self.vc2 = [self generateComponentWithComponentId:@"2"];
  58. self.vc3 = [self generateComponentWithComponentId:@"3"];
  59. _nvc = [[MockUINavigationController alloc] init];
  60. [_nvc setViewControllers:@[self.vc1, self.vc2, self.vc3]];
  61. OCMStub([self.sharedApplication keyWindow]).andReturn(self.mainWindow);
  62. }
  63. - (RNNComponentViewController *)generateComponentWithComponentId:(NSString *)componentId {
  64. RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] init];
  65. layoutInfo.componentId = componentId;
  66. return [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:_creator eventEmitter:nil presenter:[RNNComponentPresenter new] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil];
  67. }
  68. - (void)testAssertReadyForEachMethodThrowsExceptoins {
  69. NSArray* methods = [self getPublicMethodNamesForObject:self.uut];
  70. [self.uut setReadyToReceiveCommands:false];
  71. for (NSString* methodName in methods) {
  72. SEL s = NSSelectorFromString(methodName);
  73. IMP imp = [self.uut methodForSelector:s];
  74. void (*func)(id, SEL, id, id, id, id, id) = (void *)imp;
  75. XCTAssertThrowsSpecificNamed(func(self.uut,s, nil, nil, nil, nil, nil), NSException, @"BridgeNotLoadedError");
  76. }
  77. }
  78. -(NSArray*) getPublicMethodNamesForObject:(NSObject*)obj{
  79. NSMutableArray* skipMethods = [NSMutableArray new];
  80. [skipMethods addObject:@"initWithControllerFactory:eventEmitter:stackManager:modalManager:overlayManager:mainWindow:"];
  81. [skipMethods addObject:@"assertReady"];
  82. [skipMethods addObject:@"setReadyToReceiveCommands:"];
  83. [skipMethods addObject:@"readyToReceiveCommands"];
  84. [skipMethods addObject:@".cxx_destruct"];
  85. [skipMethods addObject:@"dismissedModal:"];
  86. [skipMethods addObject:@"attemptedToDismissModal:"];
  87. [skipMethods addObject:@"dismissedMultipleModals:"];
  88. NSMutableArray* result = [NSMutableArray new];
  89. // count and names:
  90. int i=0;
  91. unsigned int mc = 0;
  92. Method * mlist = class_copyMethodList(object_getClass(obj), &mc);
  93. for(i=0; i<mc; i++) {
  94. NSString *methodName = [NSString stringWithUTF8String:sel_getName(method_getName(mlist[i]))];
  95. // filter skippedMethods
  96. if (methodName && ![skipMethods containsObject:methodName]) {
  97. [result addObject:methodName];
  98. }
  99. }
  100. return result;
  101. }
  102. -(void)testDynamicStylesMergeWithStaticStyles {
  103. RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  104. initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
  105. RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
  106. RNNTestRootViewCreator* creator = [[RNNTestRootViewCreator alloc] init];
  107. RNNComponentPresenter* presenter = [[RNNComponentPresenter alloc] init];
  108. RNNComponentViewController* vc = [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:creator eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];
  109. RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:creator options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[[RNNStackPresenter alloc] init] eventEmitter:nil childViewControllers:@[vc]];
  110. [vc viewWillAppear:false];
  111. XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
  112. [self.uut setReadyToReceiveCommands:true];
  113. NSDictionary* dictFromJs = @{@"topBar": @{@"background" : @{@"color" : @(0xFFFF0000)}}};
  114. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  115. [self.uut mergeOptions:@"componentId" options:dictFromJs completion:^{
  116. XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
  117. XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
  118. }];
  119. }
  120. - (void)testMergeOptions_shouldOverrideOptions {
  121. RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  122. initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
  123. RNNComponentPresenter* presenter = [[RNNComponentPresenter alloc] init];
  124. RNNComponentViewController* vc = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:[[RNNTestRootViewCreator alloc] init] eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];
  125. __unused RNNStackController* nav = [[RNNStackController alloc] initWithRootViewController:vc];
  126. [vc viewWillAppear:false];
  127. XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
  128. [self.uut setReadyToReceiveCommands:true];
  129. NSDictionary* dictFromJs = @{@"topBar": @{@"title" : @{@"text" : @"new title"}}};
  130. [self.uut mergeOptions:@"componentId" options:dictFromJs completion:^{
  131. XCTAssertTrue([vc.navigationItem.title isEqual:@"new title"]);
  132. }];
  133. }
  134. - (void)testShowOverlay_createLayout {
  135. [self.uut setReadyToReceiveCommands:true];
  136. OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
  137. NSDictionary* layout = @{};
  138. [[self.controllerFactory expect] createLayout:layout];
  139. [self.uut showOverlay:layout commandId:@"" completion:^{}];
  140. [self.controllerFactory verify];
  141. }
  142. - (void)testShowOverlay_saveToStore {
  143. [self.uut setReadyToReceiveCommands:true];
  144. OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
  145. OCMStub([self.controllerFactory createLayout:[OCMArg any]]);
  146. [[self.controllerFactory expect] createLayout:[OCMArg any]];
  147. [self.uut showOverlay:@{} commandId:@"" completion:^{}];
  148. [self.overlayManager verify];
  149. }
  150. - (void)testShowOverlay_withCreatedLayout {
  151. [self.uut setReadyToReceiveCommands:true];
  152. UIViewController* layoutVC = [self generateComponentWithComponentId:nil];
  153. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(layoutVC);
  154. [[self.overlayManager expect] showOverlayWindow:[OCMArg any]];
  155. [self.uut showOverlay:@{} commandId:@"" completion:^{}];
  156. [self.overlayManager verify];
  157. }
  158. - (void)testShowOverlay_invokeNavigationCommandEventWithLayout {
  159. [self.uut setReadyToReceiveCommands:true];
  160. OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
  161. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  162. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  163. NSDictionary* layout = @{};
  164. [[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"showOverlay" commandId:[OCMArg any] params:[OCMArg any]];
  165. [self.uut showOverlay:layout commandId:@"" completion:^{}];
  166. [self.eventEmmiter verify];
  167. }
  168. - (void)testDismissOverlay_findComponentFromLayoutManager {
  169. [self.uut setReadyToReceiveCommands:true];
  170. NSString* componentId = @"componentId";
  171. id classMock = OCMClassMock([RNNLayoutManager class]);
  172. [[classMock expect] findComponentForId:componentId];
  173. [self.uut dismissOverlay:componentId commandId:@"" completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
  174. [classMock verify];
  175. }
  176. - (void)testDismissOverlay_dismissReturnedViewController {
  177. [self.uut setReadyToReceiveCommands:true];
  178. NSString* componentId = @"componentId";
  179. UIViewController* returnedView = [UIViewController new];
  180. id classMock = OCMClassMock([RNNLayoutManager class]);
  181. OCMStub(ClassMethod([classMock findComponentForId:componentId])).andReturn(returnedView);
  182. [[self.overlayManager expect] dismissOverlay:returnedView];
  183. [self.uut dismissOverlay:componentId commandId:@"" completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
  184. [self.overlayManager verify];
  185. }
  186. - (void)testDismissOverlay_handleErrorIfNoOverlayExists {
  187. [self.uut setReadyToReceiveCommands:true];
  188. NSString* componentId = @"componentId";
  189. id errorHandlerMockClass = [OCMockObject mockForClass:[RNNErrorHandler class]];
  190. [[errorHandlerMockClass expect] reject:[OCMArg any] withErrorCode:1010 errorDescription:[OCMArg any]];
  191. [self.uut dismissOverlay:componentId commandId:@"" completion:[OCMArg any] rejection:[OCMArg any]];
  192. [errorHandlerMockClass verify];
  193. }
  194. - (void)testDismissOverlay_invokeNavigationCommandEvent {
  195. [self.uut setReadyToReceiveCommands:true];
  196. NSString* componentId = @"componentId";
  197. id classMock = OCMClassMock([RNNLayoutManager class]);
  198. OCMStub(ClassMethod([classMock findComponentForId:componentId])).andReturn([UIViewController new]);
  199. [[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"dismissOverlay" commandId:[OCMArg any] params:[OCMArg any]];
  200. [self.uut dismissOverlay:componentId commandId:@"" completion:^{
  201. } rejection:^(NSString *code, NSString *message, NSError *error) {}];
  202. [self.eventEmmiter verify];
  203. }
  204. - (void)testSetRoot_setRootViewControllerOnMainWindow {
  205. [self.uut setReadyToReceiveCommands:true];
  206. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(self.vc1);
  207. [[self.mainWindow expect] setRootViewController:self.vc1];
  208. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  209. [self.mainWindow verify];
  210. }
  211. - (void)testSetStackRoot_resetStackWithSingleComponent {
  212. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(@[self.vc2]);
  213. [self.uut setReadyToReceiveCommands:true];
  214. id classMock = OCMClassMock([RNNLayoutManager class]);
  215. OCMStub(ClassMethod([classMock findComponentForId:@"vc1"])).andReturn(_nvc);
  216. self.vc2.options.animations.setStackRoot.enable = [[Bool alloc] initWithBOOL:NO];
  217. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  218. } rejection:^(NSString *code, NSString *message, NSError *error) {
  219. }];
  220. XCTAssertEqual(_nvc.viewControllers.firstObject, self.vc2);
  221. XCTAssertEqual(_nvc.viewControllers.count, 1);
  222. }
  223. - (void)testSetStackRoot_setMultipleChildren {
  224. NSArray* newViewControllers = @[_vc1, _vc3];
  225. id classMock = OCMClassMock([RNNLayoutManager class]);
  226. OCMStub(ClassMethod([classMock findComponentForId:@"vc1"])).andReturn(_nvc);
  227. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
  228. [self.uut setReadyToReceiveCommands:true];
  229. _vc3.options.animations.setStackRoot.enable = [[Bool alloc] initWithBOOL:NO];
  230. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  231. } rejection:^(NSString *code, NSString *message, NSError *error) {
  232. }];
  233. XCTAssertTrue([_nvc.viewControllers isEqual:newViewControllers]);
  234. }
  235. - (void)testSetStackRoot_callRenderTreeAndWaitOnce {
  236. id vc1Mock = [OCMockObject partialMockForObject:_vc1];
  237. id vc2Mock = [OCMockObject partialMockForObject:_vc2];
  238. NSArray* newViewControllers = @[vc1Mock, vc2Mock];
  239. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
  240. [self.uut setReadyToReceiveCommands:true];
  241. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  242. } rejection:^(NSString *code, NSString *message, NSError *error) {
  243. }];
  244. [[vc1Mock expect] render];
  245. [[vc2Mock expect] render];
  246. }
  247. - (void)testSetStackRoot_waitForRender {
  248. _vc2.options.animations.setStackRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  249. id vc1Mock = OCMPartialMock(_vc1);
  250. id vc2Mock = OCMPartialMock(_vc2);
  251. NSArray* newViewControllers = @[vc1Mock, vc2Mock];
  252. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
  253. [self.uut setReadyToReceiveCommands:true];
  254. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  255. } rejection:^(NSString *code, NSString *message, NSError *error) {
  256. }];
  257. [[vc1Mock expect] render];
  258. [[vc2Mock expect] render];
  259. }
  260. - (void)testSetRoot_waitForRenderTrue {
  261. [self.uut setReadyToReceiveCommands:true];
  262. self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  263. self.vc1.options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  264. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  265. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  266. [[mockedVC expect] render];
  267. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  268. [mockedVC verify];
  269. }
  270. - (void)testSetRoot_waitForRenderFalse {
  271. [self.uut setReadyToReceiveCommands:true];
  272. self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  273. self.vc1.options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:NO];
  274. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  275. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  276. [[mockedVC expect] render];
  277. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  278. [mockedVC verify];
  279. }
  280. - (void)testSetRoot_withBottomTabsAttachModeTogether {
  281. [self.uut setReadyToReceiveCommands:true];
  282. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
  283. options.bottomTabs.tabsAttachMode = [[BottomTabsAttachMode alloc] initWithValue:@"together"];
  284. BottomTabsBaseAttacher* attacher = [[[BottomTabsAttachModeFactory alloc] initWithDefaultOptions:nil] fromOptions:options];
  285. RNNBottomTabsController* tabBarController = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[RNNBasePresenter new] eventEmitter:_eventEmmiter childViewControllers:@[_vc1, _vc2] bottomTabsAttacher:attacher];
  286. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(tabBarController);
  287. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  288. XCTAssertTrue(_vc1.isViewLoaded);
  289. XCTAssertTrue(_vc2.isViewLoaded);
  290. XCTAssertEqual(_vc1.view.tag, 1);
  291. XCTAssertEqual(_vc2.view.tag, 2);
  292. }
  293. - (void)testSetRoot_withBottomTabsAttachModeOnSwitchToTab {
  294. [self.uut setReadyToReceiveCommands:true];
  295. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
  296. options.bottomTabs.tabsAttachMode = [[BottomTabsAttachMode alloc] initWithValue:@"onSwitchToTab"];
  297. options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  298. BottomTabsBaseAttacher* attacher = [[[BottomTabsAttachModeFactory alloc] initWithDefaultOptions:nil] fromOptions:options];
  299. RNNBottomTabsController* tabBarController = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[RNNBasePresenter new] eventEmitter:_eventEmmiter childViewControllers:@[_vc1, _vc2] bottomTabsAttacher:attacher];
  300. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(tabBarController);
  301. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  302. XCTAssertTrue(_vc1.isViewLoaded);
  303. XCTAssertFalse(_vc2.isViewLoaded);
  304. [tabBarController setSelectedIndex:1];
  305. XCTAssertTrue(_vc2.isViewLoaded);
  306. }
  307. - (void)testSetRoot_withBottomTabsAttachModeAfterInitialTab {
  308. [self.uut setReadyToReceiveCommands:true];
  309. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
  310. options.bottomTabs.tabsAttachMode = [[BottomTabsAttachMode alloc] initWithValue:@"afterInitialTab"];
  311. options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  312. BottomTabsBaseAttacher* attacher = [[[BottomTabsAttachModeFactory alloc] initWithDefaultOptions:nil] fromOptions:options];
  313. RNNBottomTabsController* tabBarController = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[RNNBasePresenter new] eventEmitter:_eventEmmiter childViewControllers:@[_vc1, _vc2] bottomTabsAttacher:attacher];
  314. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(tabBarController);
  315. [self.uut setRoot:@{} commandId:@"" completion:^{
  316. XCTAssertFalse(self->_vc2.isViewLoaded);
  317. }];
  318. XCTAssertTrue(_vc1.isViewLoaded);
  319. XCTAssertTrue(_vc2.isViewLoaded);
  320. }
  321. - (void)testShowModal_shouldShowAnimated {
  322. [self.uut setReadyToReceiveCommands:true];
  323. self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  324. self.vc1.options.animations.showModal.enable = [[Bool alloc] initWithBOOL:YES];
  325. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  326. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  327. [[self.modalManager expect] showModal:mockedVC animated:YES hasCustomAnimation:NO completion:[OCMArg any]];
  328. [self.uut showModal:@{} commandId:@"showModal" completion:^(NSString *componentId) {
  329. }];
  330. [self.modalManager verify];
  331. }
  332. @end