Files
iD/test/spec/Entity.js

28 lines
882 B
JavaScript

describe('Entity', function () {
var entity;
beforeEach(function () {
entity = new iD.Entity();
});
it('has no entity type', function () {
expect(entity.type).toEqual('');
});
describe('#parentWays', function () {
it('returns an array of parents with entityType way', function () {
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, type: 'way'});
entity.addParent({_id: 2, type: 'relation'});
expect(entity.parentRelations()).toEqual([{_id: 2, type: 'relation'}]);
});
});
});