瀏覽代碼

Fix flaky iOS unit tests

yogevbd 5 年之前
父節點
當前提交
f1a2c9d9c2
共有 1 個檔案被更改,包括 6 行新增11 行删除
  1. 6
    11
      lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m

+ 6
- 11
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m 查看文件

@@ -290,14 +290,10 @@
290 290
 }
291 291
 
292 292
 - (void)testSetStackRoot_callRenderTreeAndWaitOnce {
293
-	id vc1Mock = OCMPartialMock(_vc1);
294
-	id vc2Mock = OCMPartialMock(_vc2);
295
-	OCMStub([vc1Mock renderTreeAndWait:NO perform:[OCMArg any]]);
296
-	OCMStub([vc2Mock renderTreeAndWait:NO perform:[OCMArg any]]);
297
-	
293
+	id vc1Mock = [OCMockObject partialMockForObject:_vc1];
294
+	id vc2Mock = [OCMockObject partialMockForObject:_vc2];
298 295
 	NSArray* newViewControllers = @[vc1Mock, vc2Mock];
299
-	id classMock = OCMClassMock([RNNLayoutManager class]);
300
-	OCMStub(ClassMethod([classMock findComponentForId:@"vc1"])).andReturn(_nvc);
296
+	
301 297
 	OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
302 298
 	[self.uut setReadyToReceiveCommands:true];
303 299
 	[self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
@@ -314,12 +310,11 @@
314 310
 	_vc2.options.animations.setStackRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
315 311
 	id vc1Mock = OCMPartialMock(_vc1);
316 312
 	id vc2Mock = OCMPartialMock(_vc2);
317
-	OCMStub([vc1Mock renderTreeAndWait:NO perform:[OCMArg any]]);
318
-	OCMStub([vc2Mock renderTreeAndWait:YES perform:[OCMArg any]]);
313
+	
319 314
 	NSArray* newViewControllers = @[vc1Mock, vc2Mock];
320
-	id classMock = OCMClassMock([RNNLayoutManager class]);
321
-	OCMStub(ClassMethod([classMock findComponentForId:@"vc1"])).andReturn(_nvc);
315
+	
322 316
 	OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
317
+	
323 318
 	[self.uut setReadyToReceiveCommands:true];
324 319
 	[self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
325 320