Skip to content

Commit 09d2aa6

Browse files
committed
delete tests dealing with removal of circular nodes
1 parent d268b73 commit 09d2aa6

File tree

1 file changed

+39
-66
lines changed

1 file changed

+39
-66
lines changed

test/jasmine/tests/sankey_test.js

Lines changed: 39 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -239,72 +239,45 @@ describe('sankey tests', function() {
239239
});
240240
});
241241

242-
// describe('sankey calc', function() {
243-
//
244-
// function _calc(trace) {
245-
// var gd = { data: [trace] };
246-
//
247-
// supplyAllDefaults(gd);
248-
// var fullTrace = gd._fullData[0];
249-
// Sankey.calc(gd, fullTrace);
250-
// return fullTrace;
251-
// }
252-
//
253-
// var base = { type: 'sankey' };
254-
//
255-
// describe('remove nodes if encountering circularity', function() {
256-
// var errors;
257-
//
258-
// beforeEach(function() {
259-
// errors = [];
260-
// spyOn(Lib, 'error').and.callFake(function(msg) {
261-
// errors.push(msg);
262-
// });
263-
// });
264-
//
265-
// it('removing a single self-pointing node', function() {
266-
// expect(errors.length).toBe(0);
267-
//
268-
// var fullTrace = _calc(Lib.extendDeep({}, base, {
269-
// node: {
270-
// label: ['a']
271-
// },
272-
// link: {
273-
// value: [1],
274-
// source: [0],
275-
// target: [0]
276-
// }
277-
// }));
278-
//
279-
// expect(fullTrace.node.label).toEqual([], 'node label(s) removed');
280-
// expect(fullTrace.link.value).toEqual([], 'link value(s) removed');
281-
// expect(fullTrace.link.source).toEqual([], 'link source(s) removed');
282-
// expect(fullTrace.link.target).toEqual([], 'link target(s) removed');
283-
// expect(errors.length).toBe(1);
284-
// });
285-
//
286-
// it('removing everything if detecting a circle', function() {
287-
// expect(errors.length).toBe(0);
288-
//
289-
// var fullTrace = _calc(Lib.extendDeep({}, base, {
290-
// node: {
291-
// label: ['a', 'b', 'c', 'd', 'e']
292-
// },
293-
// link: {
294-
// value: [1, 1, 1, 1, 1, 1, 1, 1],
295-
// source: [0, 1, 2, 3],
296-
// target: [1, 2, 0, 4]
297-
// }
298-
// }));
299-
//
300-
// expect(fullTrace.node.label).toEqual([], 'node label(s) removed');
301-
// expect(fullTrace.link.value).toEqual([], 'link value(s) removed');
302-
// expect(fullTrace.link.source).toEqual([], 'link source(s) removed');
303-
// expect(fullTrace.link.target).toEqual([], 'link target(s) removed');
304-
// expect(errors.length).toBe(1);
305-
// });
306-
// });
307-
// });
242+
describe('sankey calc', function() {
243+
function _calc(trace) {
244+
var gd = { data: [trace] };
245+
246+
supplyAllDefaults(gd);
247+
var fullTrace = gd._fullData[0];
248+
return Sankey.calc(gd, fullTrace);
249+
}
250+
251+
var base = { type: 'sankey' };
252+
253+
it('detects circularity', function() {
254+
var calcData = _calc(Lib.extendDeep({}, base, {
255+
node: {
256+
label: ['a', 'b', 'c', 'd', 'e']
257+
},
258+
link: {
259+
value: [1, 1, 1, 1, 1, 1, 1, 1],
260+
source: [0, 1, 2, 3],
261+
target: [1, 2, 0, 4]
262+
}
263+
}));
264+
expect(calcData[0].circular).toBeTruthy();
265+
});
266+
267+
it('detects the absence of circularity', function() {
268+
var calcData = _calc(Lib.extendDeep({}, base, {
269+
node: {
270+
label: ['a', 'b', 'c', 'd', 'e']
271+
},
272+
link: {
273+
value: [1, 1, 1, 1, 1, 1, 1, 1],
274+
source: [0, 1, 2, 3],
275+
target: [1, 2, 4, 4]
276+
}
277+
}));
278+
expect(calcData[0].circular).toBe(false);
279+
});
280+
});
308281

309282
describe('lifecycle methods', function() {
310283
afterEach(destroyGraphDiv);

0 commit comments

Comments
 (0)