Skip to content

Commit 94608e9

Browse files
committed
Wait to begin thrashing until we have completed reloading the data so we aren't trying to do both operations concurrently.
1 parent e9de3b3 commit 94608e9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

AsyncDisplayKitTests/ASTableViewTests.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,19 @@ - (void)testReloadData
151151

152152
tableView.asyncDelegate = dataSource;
153153
tableView.asyncDataSource = dataSource;
154+
155+
XCTestExpectation *reloadDataExpectation = [self expectationWithDescription:@"reloadData"];
154156

155-
[tableView reloadData];
157+
[tableView reloadDataWithCompletion:^{
158+
NSLog(@"*** Reload Complete ***");
159+
[reloadDataExpectation fulfill];
160+
}];
161+
162+
[self waitForExpectationsWithTimeout:5 handler:^(NSError *error) {
163+
if (error) {
164+
XCTFail(@"Expectation failed: %@", error);
165+
}
166+
}];
156167

157168
for (int i = 0; i < NumberOfReloadIterations; ++i) {
158169
UITableViewRowAnimation rowAnimation = (arc4random_uniform(2) == 0 ? UITableViewRowAnimationMiddle : UITableViewRowAnimationNone);

0 commit comments

Comments
 (0)