diff --git a/js/id/graph/graph.js b/js/id/graph/graph.js index a830214d4..fe878de2c 100644 --- a/js/id/graph/graph.js +++ b/js/id/graph/graph.js @@ -70,7 +70,7 @@ iD.Graph.prototype = { // Resolve the id references in a way, replacing them with actual objects. fetch: function(id) { var entity = this.entities[id], nodes = []; - if (!entity.nodes || !entity.nodes.length) return iD.Entity(entity); // TODO: shouldn't be necessary + if (!entity.nodes || !entity.nodes.length) return entity; for (var i = 0, l = entity.nodes.length; i < l; i++) { nodes[i] = this.fetch(entity.nodes[i]); } diff --git a/test/spec/graph/graph.js b/test/spec/graph/graph.js index 16cbf6995..b0f71cd91 100644 --- a/test/spec/graph/graph.js +++ b/test/spec/graph/graph.js @@ -83,7 +83,7 @@ describe('iD.Graph', function() { var node = iD.Node({id: "n1"}), way = iD.Way({id: "w1", nodes: ["n1"]}), graph = iD.Graph({n1: node, w1: way}); - expect(graph.fetch("w1").nodes[0].id).to.equal("n1"); + expect(graph.fetch("w1").nodes).to.eql([node]); }); });