Move graph out of connection, move more logic to Util, update tests.

This commit is contained in:
Tom MacWright
2012-10-31 18:17:54 -04:00
parent 303128df1c
commit 7154b68b71
7 changed files with 152 additions and 205 deletions
+7 -7
View File
@@ -6,22 +6,22 @@ describe('Entity', function () {
});
it('has no entity type', function () {
expect(entity.entityType).toEqual('');
expect(entity.type).toEqual('');
});
describe('#parentWays', function () {
it('returns an array of parents with entityType way', function () {
entity.addParent({_id: 1, entityType: 'way'});
entity.addParent({_id: 2, entityType: 'node'});
expect(entity.parentWays()).toEqual([{_id: 1, entityType: 'way'}]);
entity.addParent({_id: 1, type: 'way'});
entity.addParent({_id: 2, type: 'node'});
expect(entity.parentWays()).toEqual([{_id: 1, type: 'way'}]);
});
});
describe('#parentRelations', function () {
it('returns an array of parents with entityType relation', function () {
entity.addParent({_id: 1, entityType: 'way'});
entity.addParent({_id: 2, entityType: 'relation'});
expect(entity.parentRelations()).toEqual([{_id: 2, entityType: 'relation'}]);
entity.addParent({_id: 1, type: 'way'});
entity.addParent({_id: 2, type: 'relation'});
expect(entity.parentRelations()).toEqual([{_id: 2, type: 'relation'}]);
});
});
});