mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-05 22:48:21 +00:00
Provide full test coverage for IGListBatchUpdateData.mm
Summary: There were some codepaths in `IGListBatchUpdateData.mm` that weren't completely covered by our unit test suite. Namely the equality checks where the object addresses are compared, and when incompatible objects are compared. This diff adds 2 extra tests to cover those cases, bringing `IGListBatchUpdateData.mm`'s test coverage up to 100%. Differential Revision: D44001262 fbshipit-source-id: 516851ca6ebdcbf3a1a4e7e6e0bd2efcef69920a
This commit is contained in:
parent
9e457c39da
commit
a41026d93d
1 changed files with 23 additions and 0 deletions
|
|
@ -151,4 +151,27 @@ static IGListMoveIndex *newMove(NSInteger from, NSInteger to) {
|
|||
XCTAssertEqualObjects(result.deleteIndexPaths, @[newPath(2, 0)]);
|
||||
}
|
||||
|
||||
- (void)test_whenUpdatesAreClean_thatObjectIsEqualToItself {
|
||||
IGListBatchUpdateData *result = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[@0, @1])
|
||||
deleteSections:indexSet(@[@5])
|
||||
moveSections:[NSSet setWithArray:@[newMove(3, 4)]]
|
||||
insertIndexPaths:@[newPath(0, 0)]
|
||||
deleteIndexPaths:@[newPath(1, 0)]
|
||||
updateIndexPaths:@[]
|
||||
moveIndexPaths:@[newMovePath(6, 0, 6, 1)]];
|
||||
XCTAssertTrue([result isEqual:result]);
|
||||
}
|
||||
|
||||
- (void)test_whenEmptyUpdates_thatResultDoesNotEqualOtherClasses {
|
||||
IGListBatchUpdateData *emptyResult = [[IGListBatchUpdateData alloc] initWithInsertSections:indexSet(@[])
|
||||
deleteSections:indexSet(@[])
|
||||
moveSections:[NSSet new]
|
||||
insertIndexPaths:@[]
|
||||
deleteIndexPaths:@[]
|
||||
updateIndexPaths:@[]
|
||||
moveIndexPaths:@[]];
|
||||
|
||||
XCTAssertFalse([emptyResult isEqual:[NSObject new]]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Reference in a new issue