Skip to content

Instantly share code, notes, and snippets.

@DevAlloy
Created July 2, 2015 07:16
Show Gist options
  • Save DevAlloy/438405e7dfd007784317 to your computer and use it in GitHub Desktop.
Save DevAlloy/438405e7dfd007784317 to your computer and use it in GitHub Desktop.
- (void)testFeedMapperStrongParentChildClustersRelations {
// given
NSInteger expectedCountOfRootClusters = 10;
// when
[self.clusterIdsMapper mapServerResponse:self.regularServerResponse mappingContext:@{RDNMapperClustersTopicNameKey : RDNFirstTopicIdentifier}];
NSArray *cachedClustersArray = [RDNCluster MR_findAll];
// then
NSMutableSet *clusterIdsSet = [NSMutableSet new];
NSInteger currentNumberOfRootClusters = 0;
for (RDNCluster *cluster in cachedClustersArray) {
XCTAssertFalse([clusterIdsSet containsObject:cluster.clusterId], @"Cluster %@ duplicated", cluster.clusterId);
[clusterIdsSet addObject:cluster.clusterId];
if (cluster.childClusters.count > 0) {
currentNumberOfRootClusters++;
}
}
XCTAssertEqual(expectedCountOfRootClusters, currentNumberOfRootClusters, @"Wrong number of parent clusters");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment