diff --git a/FastEasyMappingTests/Specs/FEMRepresentationUtilitySpec.m b/FastEasyMappingTests/Specs/FEMRepresentationUtilitySpec.m index 205c99f..97dee73 100644 --- a/FastEasyMappingTests/Specs/FEMRepresentationUtilitySpec.m +++ b/FastEasyMappingTests/Specs/FEMRepresentationUtilitySpec.m @@ -1,24 +1,25 @@ // For License please refer to LICENSE file in the root of FastEasyMapping project #import -#import -#import "Fixture.h" - -#import "Person.h" -#import "FEMMapping.h" -#import "FEMObjectCache.h" -#import "MappingProvider.h" -#import "Car.h" +@import FastEasyMapping; -#import "FEMDeserializer.h" -#import "FEMRelationship.h" -#import "FEMRepresentationUtility.h" +#import "Fixture.h" +#import "Chat+Mapping.h" SPEC_BEGIN(FEMRepresentationUtilitySpec) describe(@"FEMRepresentationCollectPresentedPrimaryKeys", ^{ context(@"indirect recursive relationship", ^{ - + it(@"should combine similar mappings", ^{ + NSDictionary *fixture = [Fixture buildUsingFixture:@"RecursiveChatLastMessage"]; + FEMMapping *mapping = [Chat chatLastMessageMapping]; + + NSDictionary *> *map = FEMRepresentationCollectPresentedPrimaryKeys(fixture, mapping); + [[[map should] have:2] values]; + + [[map[mapping.uniqueIdentifier] should] equal:[NSSet setWithObject:@1]]; + [[map[[mapping relationshipForProperty:@"lastMessage"].mapping.uniqueIdentifier] should] equal:[NSSet setWithObject:@300]]; + }); }); });