more unit tests

This commit is contained in:
Klemek
2019-07-16 15:09:49 +02:00
parent ed8ddd349d
commit 75162b8b79
2 changed files with 19 additions and 0 deletions
+3
View File
@@ -129,6 +129,9 @@ module.exports = (options) => {
return null;
if (typeof icon === 'object') {
if (!icon.path || !icon.path.trim())
return null;
icon.height = icon.height || icon.width || resources.height;
icon.width = icon.width || icon.height;
return icon;
+16
View File
@@ -171,6 +171,22 @@ describe('getIcon', () => {
height: 512
});
});
test('custom invalid icon', () => {
const res = rendering().getIcon({
paht: 'hello',
width: 80,
height: 160
});
expect(res).toBe(null);
});
test('custom invalid icon 2', () => {
const res = rendering().getIcon({
path: '',
width: 80,
height: 160
});
expect(res).toBe(null);
});
});
describe('getLinkPath (non-regression)', () => {