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'
|
||||
+ ' by internal attribute and value', function() {
|
||||
|
||||
|
@ -996,7 +1002,7 @@
|
|||
});
|
||||
});
|
||||
|
||||
it('should expand a community if enough space is available', function() {
|
||||
it('should expand a community if enough space is available', function() {
|
||||
runs(function() {
|
||||
adapter.setNodeLimit(10);
|
||||
callbackCheck = false;
|
||||
|
@ -1019,7 +1025,7 @@
|
|||
});
|
||||
|
||||
it('should expand a community and join another '
|
||||
+ 'one if not enough space is available', function() {
|
||||
+ 'one if not enough space is available', function() {
|
||||
runs(function() {
|
||||
fakeResult = [c1, c7];
|
||||
callbackCheck = false;
|
||||
|
@ -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,21 +209,127 @@
|
|||
expect(c2._outboundCounter).toEqual(1);
|
||||
});
|
||||
|
||||
it('should expand a community node properly', function() {
|
||||
var comm = {
|
||||
_id: "*community_1"
|
||||
};
|
||||
nodes.push(comm);
|
||||
describe('with community nodes', function() {
|
||||
|
||||
spyOn(adapterDummy, "expandCommunity");
|
||||
it('should expand a community node properly', function() {
|
||||
var comm = {
|
||||
_id: "*community_1"
|
||||
};
|
||||
nodes.push(comm);
|
||||
|
||||
testee = eventLib.Expand(config);
|
||||
testee(comm);
|
||||
spyOn(adapterDummy, "expandCommunity");
|
||||
|
||||
testee = eventLib.Expand(config);
|
||||
testee(comm);
|
||||
|
||||
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]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
expect(adapterDummy.expandCommunity).toHaveBeenCalledWith(comm, jasmine.any(Function));
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
describe('setup process', function() {
|
||||
|
||||
var testConfig = {};
|
||||
|
|
Loading…
Reference in New Issue