mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-05 22:48:21 +00:00
Added remaining test coverage to IGListBindingSectionController
Summary: Added remaining test cases to cover `IGListBindingSectionController` Reviewed By: candance Differential Revision: D45004640 fbshipit-source-id: 2dd1662af849841ab5dccc1f6731ddac800657a0
This commit is contained in:
parent
2b0ca81c0b
commit
97120d288d
1 changed files with 27 additions and 0 deletions
|
|
@ -24,6 +24,12 @@
|
|||
#import "IGTestObject.h"
|
||||
#import "IGTestStringBindableCell.h"
|
||||
|
||||
@interface IGListBindingSectionController (Tests)
|
||||
|
||||
- (void)setState:(NSInteger)state;
|
||||
|
||||
@end
|
||||
|
||||
@interface IGListBindingSectionControllerTests : IGListTestCase
|
||||
|
||||
@end
|
||||
|
|
@ -481,4 +487,25 @@
|
|||
XCTAssertEqual([section.viewModels lastObject], @20);
|
||||
}
|
||||
|
||||
#pragma mark - Illegal state validation
|
||||
|
||||
- (void)test_whenAdapterReloadsObjects_andStateIsInconsistent_thatExecutionCompletes {
|
||||
[self setupWithObjects:@[
|
||||
[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@7, @"seven"]],
|
||||
]];
|
||||
[self.adapter reloadObjects:@[[[IGTestDiffingObject alloc] initWithKey:@1 objects:@[@"four", @4, @"seven", @7]]]];
|
||||
|
||||
// Queue up the batch operation which will be called on the next main run loop
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:NSStringFromSelector(_cmd)];
|
||||
[self.adapter performBatchAnimated:YES updates:^(id<IGListBatchContext> batchContext){} completion:^(BOOL finished) {
|
||||
[expectation fulfill];
|
||||
}];
|
||||
|
||||
// Before the next run loop triggers, set the state back to idle
|
||||
IGListBindingSectionController *controller = (IGListBindingSectionController *)[self.adapter sectionControllerForSection:0];
|
||||
[controller setState:0];
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Reference in a new issue