mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Added tests for expanding/collapsing of nodes if communitynodes are inside the graph
This commit is contained in:
parent
276b3cf776
commit
74179e697d
|
@ -466,6 +466,12 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should map loadNode to loadByID', function() {
|
||||||
|
spyOn(adapter, "loadNodeFromTreeById");
|
||||||
|
adapter.loadNode("a", "b");
|
||||||
|
expect(adapter.loadNodeFromTreeById).toHaveBeenCalledWith("a", "b");
|
||||||
|
});
|
||||||
|
|
||||||
it('should be able to load a tree node from ArangoDB'
|
it('should be able to load a tree node from ArangoDB'
|
||||||
+ ' by internal attribute and value', function() {
|
+ ' by internal attribute and value', function() {
|
||||||
|
|
||||||
|
@ -1079,6 +1085,26 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should connect edges to community-internal nodes', function() {
|
||||||
|
|
||||||
|
runs(function() {
|
||||||
|
insertEdge(edgesCollection, c3, c0);
|
||||||
|
|
||||||
|
adapter.setNodeLimit(20);
|
||||||
|
callbackCheck = false;
|
||||||
|
adapter.loadNode(c3, checkCallbackFunction);
|
||||||
|
});
|
||||||
|
|
||||||
|
waitsFor(function() {
|
||||||
|
return callbackCheck;
|
||||||
|
});
|
||||||
|
|
||||||
|
runs(function() {
|
||||||
|
existEdge(c3, firstCommId);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -209,6 +209,8 @@
|
||||||
expect(c2._outboundCounter).toEqual(1);
|
expect(c2._outboundCounter).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('with community nodes', function() {
|
||||||
|
|
||||||
it('should expand a community node properly', function() {
|
it('should expand a community node properly', function() {
|
||||||
var comm = {
|
var comm = {
|
||||||
_id: "*community_1"
|
_id: "*community_1"
|
||||||
|
@ -223,6 +225,110 @@
|
||||||
expect(adapterDummy.expandCommunity).toHaveBeenCalledWith(comm, jasmine.any(Function));
|
expect(adapterDummy.expandCommunity).toHaveBeenCalledWith(comm, jasmine.any(Function));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should remove a community if last pointer to it is collapsed', function() {
|
||||||
|
|
||||||
|
runs(function() {
|
||||||
|
var c0 = {
|
||||||
|
_id: 0,
|
||||||
|
_outboundCounter: 1,
|
||||||
|
_inboundCounter: 0
|
||||||
|
},
|
||||||
|
c1 = {
|
||||||
|
_id: 1,
|
||||||
|
_expanded: true,
|
||||||
|
_outboundCounter: 1,
|
||||||
|
_inboundCounter: 1
|
||||||
|
},
|
||||||
|
comm = {
|
||||||
|
_id: "*community_1",
|
||||||
|
_outboundCounter: 1,
|
||||||
|
_inboundCounter: 1
|
||||||
|
},
|
||||||
|
c2 = {
|
||||||
|
_id: 1,
|
||||||
|
_outboundCounter: 0,
|
||||||
|
_inboundCounter: 1
|
||||||
|
},
|
||||||
|
e0 = {
|
||||||
|
source: c0,
|
||||||
|
target: c1
|
||||||
|
},
|
||||||
|
e1 = {
|
||||||
|
source: c1,
|
||||||
|
target: comm
|
||||||
|
},
|
||||||
|
e2 = {
|
||||||
|
source: comm,
|
||||||
|
target: c2
|
||||||
|
};
|
||||||
|
nodes.push(c0);
|
||||||
|
nodes.push(c1);
|
||||||
|
nodes.push(comm);
|
||||||
|
nodes.push(c2);
|
||||||
|
edges.push(e0);
|
||||||
|
edges.push(e1);
|
||||||
|
edges.push(e2);
|
||||||
|
|
||||||
|
testee = eventLib.Expand(config);
|
||||||
|
testee(c1);
|
||||||
|
|
||||||
|
expect(nodes).toEqual([c0, c1]);
|
||||||
|
expect(edges).toEqual([e0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not remove a community if a pointer to it still exists', function() {
|
||||||
|
|
||||||
|
runs(function() {
|
||||||
|
var c0 = {
|
||||||
|
_id: 0,
|
||||||
|
_outboundCounter: 2,
|
||||||
|
_inboundCounter: 0
|
||||||
|
},
|
||||||
|
c1 = {
|
||||||
|
_id: 1,
|
||||||
|
_expanded: true,
|
||||||
|
_outboundCounter: 1,
|
||||||
|
_inboundCounter: 1
|
||||||
|
},
|
||||||
|
comm = {
|
||||||
|
_id: "*community_1",
|
||||||
|
_outboundCounter: 0,
|
||||||
|
_inboundCounter: 2
|
||||||
|
},
|
||||||
|
e0 = {
|
||||||
|
source: c0,
|
||||||
|
target: c1
|
||||||
|
},
|
||||||
|
e1 = {
|
||||||
|
source: c0,
|
||||||
|
target: comm
|
||||||
|
},
|
||||||
|
e2 = {
|
||||||
|
source: c1,
|
||||||
|
target: comm
|
||||||
|
};
|
||||||
|
nodes.push(c0);
|
||||||
|
nodes.push(c1);
|
||||||
|
nodes.push(comm);
|
||||||
|
edges.push(e0);
|
||||||
|
edges.push(e1);
|
||||||
|
edges.push(e2);
|
||||||
|
|
||||||
|
testee = eventLib.Expand(config);
|
||||||
|
testee(c1);
|
||||||
|
|
||||||
|
expect(nodes).toEqual([c0, c1, comm]);
|
||||||
|
expect(edges).toEqual([e0, e1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe('setup process', function() {
|
describe('setup process', function() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue