more unit tests

This commit is contained in:
Klemek
2019-07-16 10:58:02 +02:00
parent 91e57fb959
commit 22e20f3b8d
2 changed files with 70 additions and 0 deletions
+28
View File
@@ -99,6 +99,34 @@ describe('getIcon', () => {
});
});
/*test('write data', () => {
const data = {};
['default', 'line', 'double', 'split-double', 'dashed', 'dashed-line', 'dashed-double', 'dashed-split-double'].forEach(type => {
data[type] = {};
[1, 1.5, 2].forEach(width => {
data[type][width] = rendering().getLinkPath(type, width);
});
});
fs.writeFileSync('test/link_path_data.json', JSON.stringify(data), {encoding: 'utf-8'});
});*/
describe('getLinkPath (non-regression)', () => {
let data = {};
beforeAll(() => {
data = JSON.parse(fs.readFileSync('test/link_path_data.json', {encoding: 'utf-8'}));
});
['default', 'line', 'double', 'split-double', 'dashed', 'dashed-line', 'dashed-double', 'dashed-split-double'].forEach(type => {
data[type] = {};
[1, 1.5, 2].forEach(width => {
test(type + ' ' + width, () => {
expect(rendering().getLinkPath(type, width)).toEqual(data[type][width]);
});
});
});
});
describe('getBounds', () => {
test('no nodes', () => {
const res = rendering().getBounds({});