import { Path } from '../shapes/Path'; import { loadSVGFromString } from './loadSVGFromString'; describe('loadSVGFromString', () => { it('returns successful parse of svg with use tag containing bad reference', async () => { // in this case, ignore bad use but still load rest of svg const str = ` `; const parsedSvg = await loadSVGFromString(str); expect(parsedSvg.objects[0]).not.toBeNull(); if (parsedSvg.objects[0] !== null) { expect(parsedSvg.objects[0].isType('Rect')).toBe(true); } }); it('returns successful parse of svg with use tag containing bad clip-path', async () => { // in this case, load svg but ignore clip-path attribute in const str = ` `; // need to load Path here for it to populate in class registry; loadSvgFromString does not // import Path so we'd fail the test without this. const unused = Path.name; const parsedSvg = await loadSVGFromString(str); if (parsedSvg.objects[0] !== null) { expect(parsedSvg.objects[0].isType('Path')).toBe(true); } }); });