more unit tests
This commit is contained in:
@@ -129,6 +129,9 @@ module.exports = (options) => {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (typeof icon === 'object') {
|
if (typeof icon === 'object') {
|
||||||
|
if (!icon.path || !icon.path.trim())
|
||||||
|
return null;
|
||||||
|
|
||||||
icon.height = icon.height || icon.width || resources.height;
|
icon.height = icon.height || icon.width || resources.height;
|
||||||
icon.width = icon.width || icon.height;
|
icon.width = icon.width || icon.height;
|
||||||
return icon;
|
return icon;
|
||||||
|
|||||||
@@ -171,6 +171,22 @@ describe('getIcon', () => {
|
|||||||
height: 512
|
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)', () => {
|
describe('getLinkPath (non-regression)', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user