Skip to content

Commit

Permalink
GH-96 Add spec for presented primary keys collecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Zen committed May 19, 2017
1 parent c00f392 commit acb2a11
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions FastEasyMappingTests/Specs/FEMRepresentationUtilitySpec.m
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
// For License please refer to LICENSE file in the root of FastEasyMapping project

#import <Kiwi/Kiwi.h>
#import <MagicalRecord/MagicalRecord.h>

#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<NSNumber *, NSSet<id> *> *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]];
});
});
});

Expand Down

0 comments on commit acb2a11

Please sign in to comment.