Files
iD/test/spec/actions/delete_member.js
Bryan Housel 71b2d2c6b7 Upgrade legacy symbols in tests
- iD.Context -> iD.coreContext
- iD.Graph -> iD.coreGraph
- iD.Node -> iD.osmNode
- iD.Way -> iD.osmWay
- iD.Relation -> iD.osmRelation
2019-01-30 15:43:02 -05:00

19 lines
803 B
JavaScript

describe('iD.actionDeleteMember', function () {
it('removes the member at the specified index', function () {
var a = iD.osmNode({id: 'a'}),
b = iD.osmNode({id: 'b'}),
r = iD.osmRelation({members: [{id: 'a'}, {id: 'b'}]}),
action = iD.actionDeleteMember(r.id, 0),
graph = action(iD.coreGraph([a, b, r]));
expect(graph.entity(r.id).members).to.eql([{id: 'b'}]);
});
it('deletes relations that become degenerate', function () {
var a = iD.osmNode({id: 'a'}),
r = iD.osmRelation({id: 'r', members: [{id: 'a'}]}),
action = iD.actionDeleteMember(r.id, 0),
graph = action(iD.coreGraph([a, r]));
expect(graph.hasEntity('r')).to.be.undefined;
});
});