mirror of https://gitee.com/bigwinds/arangodb
GraphViewer: Added Tests for communication between Adapter and NodeReducer
This commit is contained in:
parent
17cb716bdc
commit
4161ff662c
|
@ -613,7 +613,11 @@
|
|||
beforeEach(function() {
|
||||
|
||||
runs(function() {
|
||||
|
||||
var self = this;
|
||||
this.fakeReducerRequest = function() {};
|
||||
spyOn(window, "NodeReducer").andCallFake(function(v, e) {
|
||||
this.getCommunity = self.fakeReducerRequest;
|
||||
});
|
||||
spyOn($, "ajax").andCallFake(function(request) {
|
||||
if (spyHook !== undefined) {
|
||||
if(!spyHook(request)) {
|
||||
|
@ -840,6 +844,22 @@
|
|||
});
|
||||
});
|
||||
|
||||
it('should trigger the reducer if too many nodes are added', function() {
|
||||
|
||||
runs(function() {
|
||||
adapter.setNodeLimit(6);
|
||||
spyOn(this, "fakeReducerRequest");
|
||||
adapter.loadNodeFromTreeById(c1, checkCallbackFunction);
|
||||
expect(this.fakeReducerRequest).toHaveBeenCalledWith(6, c1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should not trigger the reducer if the limit is set large enough', function() {
|
||||
spyOn(this, "fakeReducerRequest");
|
||||
adapter.setNodeLimit(10);
|
||||
expect(this.fakeReducerRequest).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('that has loaded several queries', function() {
|
||||
var c8, c9, e2_8;
|
||||
|
||||
|
|
|
@ -139,6 +139,19 @@
|
|||
expect(com).toContainNodes([5, 6, 7]);
|
||||
});
|
||||
|
||||
it('should also take the best community if no focus is given', function() {
|
||||
helper.insertSimpleNodes(nodes, [0, 1, 2, 3, 4, 5, 6, 7]);
|
||||
helper.insertClique(nodes, edges, [0, 1, 2]);
|
||||
edges.push(helper.createSimpleEdge(nodes, 3, 2));
|
||||
edges.push(helper.createSimpleEdge(nodes, 3, 4));
|
||||
edges.push(helper.createSimpleEdge(nodes, 4, 5));
|
||||
edges.push(helper.createSimpleEdge(nodes, 5, 6));
|
||||
edges.push(helper.createSimpleEdge(nodes, 5, 7));
|
||||
|
||||
var com = reducer.getCommunity(6);
|
||||
expect(com).toContainNodes([0, 1, 2]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue