import { fromDPath } from './fromDPath' it('should parse and convert a d path to nemi curves', () => { const dPath = 'M218 0.5H583C703.122 0.5 800.5 97.8781 800.5 218C800.5 338.122 703.122 435.5 583 435.5H218C97.8781 435.5 0.5 338.122 0.5 218C0.5 97.8781 97.8781 0.5 218 0.5Z' const answer = [ { type: 'line', startPoint: { x: 218, y: 0.5 }, endPoint: { x: 583, y: 0.5 }, }, { type: 'bezier', startPoint: { x: 583, y: 0.5 }, controlPoint1: { x: 703.122, y: 0.5 }, controlPoint2: { x: 800.5, y: 97.8781 }, endPoint: { x: 800.5, y: 218 }, }, { type: 'bezier', startPoint: { x: 800.5, y: 218 }, controlPoint1: { x: 800.5, y: 338.122 }, controlPoint2: { x: 703.122, y: 435.5 }, endPoint: { x: 583, y: 435.5 }, }, { type: 'line', startPoint: { x: 583, y: 435.5 }, endPoint: { x: 218, y: 435.5 }, }, { type: 'bezier', startPoint: { x: 218, y: 435.5 }, controlPoint1: { x: 97.8781, y: 435.5 }, controlPoint2: { x: 0.5, y: 338.122 }, endPoint: { x: 0.5, y: 218 }, }, { type: 'bezier', startPoint: { x: 0.5, y: 218 }, controlPoint1: { x: 0.5, y: 97.8781 }, controlPoint2: { x: 97.8781, y: 0.5 }, endPoint: { x: 218, y: 0.5 }, }, ] const curves = fromDPath(dPath) expect(curves.length).toBe(answer.length) expect(curves).toEqual(answer) }) it('should parse and convert a d path to nemi curves', () => { const dPath = 'M0.5 277C0.5 124.293 124.293 0.5 277 0.5H642C794.707 0.5 918.5 124.293 918.5 277C918.5 429.707 794.707 553.5 642 553.5H277C124.293 553.5 0.5 429.707 0.5 277Z' const curves = fromDPath(dPath) console.log('curves: ', curves) })