@jscad/svg-deserializer 2.5.11 → 3.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,33 +1,29 @@
1
- const test = require('ava')
1
+ import test from 'ava'
2
2
 
3
- const countOf = require('../../test/helpers/countOf')
3
+ import { countOf } from '../../test/helpers/countOf.js'
4
4
 
5
- const deserializer = require('../src/index.js')
6
-
7
- // deserializer
8
-
9
- // ################################
5
+ import { deserialize } from '../src/index.js'
10
6
 
11
7
  test('deserialize : translate svg (rect) to script', (t) => {
12
8
  const sourceSvg = `<svg pxpmm="10" width="500" height="500">
13
9
  <rect x="80" y="60" width="250" height="250" color="red"/>
14
- <rect x="140" y="120" width="250" height="250" rx="40" color="rgba(0,255,0)"/>
10
+ <rect x="140" y="120" width="250" height="250" rx="40" color="rgb(0,255,0)"/>
15
11
  <rect x="140" y="120" width="250" height="250" ry="40" color="blue"/>
16
12
  <rect x="40" y="20" width="250" height="250" rx="40" ry="40"/>
17
13
  </svg>`
18
14
 
19
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
15
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
20
16
  t.is(typeof obs, 'string')
21
17
  t.is(countOf('rectangle', obs), 1)
22
18
  t.is(countOf('roundedRectangle', obs), 3)
23
- t.is(countOf('colors.colorize', obs), 2) // color
19
+ t.is(countOf('colors.colorize', obs), 3) // color
24
20
  t.is(countOf('path2.fromPoints', obs), 4)
25
21
 
26
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
22
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
27
23
  t.is(typeof obs, 'string')
28
24
  t.is(countOf('rectangle', obs), 1)
29
25
  t.is(countOf('roundedRectangle', obs), 3)
30
- t.is(countOf('colors.colorize', obs), 2) // color
26
+ t.is(countOf('colors.colorize', obs), 3) // color
31
27
  t.is(countOf('path2.fromPoints', obs), 0)
32
28
  })
33
29
 
@@ -38,13 +34,13 @@ test('deserialize : translate svg (circle) to script', (t) => {
38
34
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
39
35
  </svg>`
40
36
 
41
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
37
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
42
38
  t.is(typeof obs, 'string')
43
39
  t.is(countOf('circle', obs), 1)
44
40
  t.is(countOf('colors.colorize', obs), 1) // stroke
45
41
  t.is(countOf('path2.fromPoints', obs), 1)
46
42
 
47
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
43
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
48
44
  t.is(typeof obs, 'string')
49
45
  t.is(countOf('circle', obs), 1)
50
46
  t.is(countOf('colors.colorize', obs), 1) // fill
@@ -59,13 +55,13 @@ test('deserialize : translate svg (ellipse) to script', (t) => {
59
55
  </svg>
60
56
  `
61
57
 
62
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
58
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
63
59
  t.is(typeof obs, 'string')
64
60
  t.is(countOf('ellipse', obs), 1)
65
61
  t.is(countOf('colors.colorize', obs), 0)
66
62
  t.is(countOf('path2.fromPoints', obs), 1)
67
63
 
68
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
64
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
69
65
  t.is(typeof obs, 'string')
70
66
  t.is(countOf('ellipse', obs), 1)
71
67
  t.is(countOf('colors.colorize', obs), 0)
@@ -79,11 +75,11 @@ test('deserialize : translate svg (line) to script', (t) => {
79
75
  <line x1="20" y1="100" x2="100" y2="20" stroke-width="2" stroke="black"/>
80
76
  </svg>`
81
77
 
82
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
78
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
83
79
  t.is(typeof obs, 'string')
84
80
  t.is(countOf('line', obs), 2) // line, and line position
85
81
 
86
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
82
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
87
83
  t.is(typeof obs, 'string')
88
84
  // TODO
89
85
 
@@ -94,7 +90,7 @@ test('deserialize : translate svg (line) to script', (t) => {
94
90
  </g>
95
91
  </svg>`
96
92
 
97
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
93
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
98
94
  t.is(typeof obs, 'string')
99
95
  t.is(countOf('line', obs), 2) // line, and line position
100
96
  })
@@ -106,12 +102,12 @@ test('deserialize : translate svg (polygon) to script', (t) => {
106
102
  <polygon points="60,20 100,40 100,80 60,100 20,80 20,40"/>
107
103
  </svg>`
108
104
 
109
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
105
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
110
106
  t.is(typeof obs, 'string')
111
107
  t.is(countOf('polygon', obs), 1)
112
108
  t.is(countOf('path2.fromPoints', obs), 1)
113
109
 
114
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
110
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
115
111
  t.is(typeof obs, 'string')
116
112
  t.is(countOf('polygon', obs), 1)
117
113
  t.is(countOf('path2.fromPoints', obs), 0)
@@ -124,11 +120,11 @@ test('deserialize : translate svg (polyline) to script', (t) => {
124
120
  <polyline fill="none" stroke="black" stroke-width="2" points="20,100 40,60 70,80 100,20"/>
125
121
  </svg>`
126
122
 
127
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
123
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
128
124
  t.is(typeof obs, 'string')
129
125
  t.is(countOf('path2.fromPoints', obs), 1)
130
126
 
131
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
127
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
132
128
  t.is(typeof obs, 'string')
133
129
  // FIXME t.is(countOf('path2.fromPoints', obs), 1)
134
130
 
@@ -139,7 +135,7 @@ test('deserialize : translate svg (polyline) to script', (t) => {
139
135
  </g>
140
136
  </svg>`
141
137
 
142
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
138
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
143
139
  t.is(typeof obs, 'string')
144
140
  t.is(countOf('path2.fromPoints', obs), 1)
145
141
  })
@@ -151,21 +147,21 @@ test('deserialize : translate svg (path: simple) to script', (t) => {
151
147
  <path stroke="black" stroke-width="2" d="M150 0 L75 200 L225 200 Z" />
152
148
  </svg>`
153
149
 
154
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
150
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
155
151
  t.is(typeof obs, 'string')
156
152
  t.is(countOf('path2.fromPoints', obs), 1)
157
153
  t.is(countOf('path2.appendPoints', obs), 2)
158
154
  t.is(countOf('path2.close', obs), 1)
159
155
  t.is(countOf('colors.colorize', obs), 1) // stroke
160
- t.is(countOf('geom2.fromPoints', obs), 0)
156
+ t.is(countOf('geom2.create', obs), 0)
161
157
 
162
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
158
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
163
159
  t.is(typeof obs, 'string')
164
160
  t.is(countOf('path2.fromPoints', obs), 1)
165
161
  t.is(countOf('path2.appendPoints', obs), 2)
166
162
  t.is(countOf('path2.close', obs), 1)
167
163
  t.is(countOf('colors.colorize', obs), 1)
168
- t.is(countOf('geom2.fromPoints', obs), 1)
164
+ t.is(countOf('geom2.create', obs), 1)
169
165
 
170
166
  // test getting stroke width from group
171
167
  sourceSvg = `<svg width="120" height="120" viewBox="0 0 120 120">
@@ -174,7 +170,7 @@ test('deserialize : translate svg (path: simple) to script', (t) => {
174
170
  </g>
175
171
  </svg>`
176
172
 
177
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
173
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
178
174
  t.is(typeof obs, 'string')
179
175
  t.is(countOf('path2.fromPoints', obs), 1)
180
176
  t.is(countOf('path2.appendPoints', obs), 2)
@@ -183,35 +179,35 @@ test('deserialize : translate svg (path: simple) to script', (t) => {
183
179
  <path d="m 150 0 l 75 200 l -225 0 z" />
184
180
  </svg>`
185
181
 
186
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
182
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
187
183
  t.is(typeof obs, 'string')
188
184
  t.is(countOf('path2.fromPoints', obs), 1)
189
185
  t.is(countOf('path2.appendPoints', obs), 2)
190
186
  t.is(countOf('path2.close', obs), 1)
191
- t.is(countOf('geom2.fromPoints', obs), 0)
187
+ t.is(countOf('geom2.create', obs), 0)
192
188
 
193
189
  sourceSvg = `<svg width="120" height="120" viewBox="0 0 120 120">
194
190
  <path fill="#ff8000" d="m 240.00000 190.00000 h 30.00000 v 30.00000 h 30.00000 v 30.00000 h 30.00000 v 30.00000 h -90.00000 v -90.00000 z"/>
195
191
  </svg>`
196
192
 
197
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
193
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
198
194
  t.is(typeof obs, 'string')
199
195
  t.is(countOf('path2.fromPoints', obs), 1)
200
196
  t.is(countOf('path2.appendPoints', obs), 8)
201
197
  t.is(countOf('path2.close', obs), 1)
202
- t.is(countOf('geom2.fromPoints', obs), 1)
198
+ t.is(countOf('geom2.create', obs), 1)
203
199
  t.is(countOf('colors.colorize', obs), 1) // fill
204
200
 
205
201
  sourceSvg = `<svg width="120" height="120" viewBox="0 0 120 120">
206
202
  <path d="M 240.00000 56.00000 H 270.00000 V 86.00000 H 300.00000 V 116.00000 H 330.00000 V 146.00000 H 240.00000 V 56.00000 Z"/>
207
203
  </svg>`
208
204
 
209
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
205
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
210
206
  t.is(typeof obs, 'string')
211
207
  t.is(countOf('path2.fromPoints', obs), 1)
212
208
  t.is(countOf('path2.appendPoints', obs), 8)
213
209
  t.is(countOf('path2.close', obs), 1)
214
- t.is(countOf('geom2.fromPoints', obs), 0)
210
+ t.is(countOf('geom2.create', obs), 0)
215
211
  })
216
212
 
217
213
  // ################################
@@ -221,25 +217,25 @@ test('deserialize : translate svg (path: arc) to script', (t) => {
221
217
  <path d="M 230 230 A 45 45 0 1 1 275 275 L 275 230 Z"/>
222
218
  </svg>`
223
219
 
224
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
220
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
225
221
  t.is(typeof obs, 'string')
226
222
  t.is(countOf('path2.fromPoints', obs), 1)
227
223
  t.is(countOf('path2.appendArc', obs), 1)
228
224
  t.is(countOf('path2.appendPoints', obs), 1)
229
225
  t.is(countOf('path2.close', obs), 1)
230
- t.is(countOf('geom2.fromPoints', obs), 0)
226
+ t.is(countOf('geom2.create', obs), 0)
231
227
 
232
228
  sourceSvg = `<svg height="500" width="500">
233
229
  <path d="M100,100 L150,100 a50,25 0 0,0 150,100 q50,-50 70,-170 Z"/>
234
230
  </svg>`
235
231
 
236
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
232
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
237
233
  t.is(typeof obs, 'string')
238
234
  t.is(countOf('path2.fromPoints', obs), 1)
239
235
  t.is(countOf('path2.appendArc', obs), 1)
240
236
  t.is(countOf('path2.appendBezier', obs), 1)
241
237
  t.is(countOf('path2.close', obs), 1)
242
- t.is(countOf('geom2.fromPoints', obs), 1)
238
+ t.is(countOf('geom2.create', obs), 1)
243
239
  })
244
240
 
245
241
  // ################################
@@ -249,23 +245,23 @@ test('deserialize : translate svg (path: bezier) to script', (t) => {
249
245
  <path d="M100,100 L150,100 a50,25 0 0,0 150,100 q50,-50 70,-170 Z" style="stroke: #006666; fill: none;"/>
250
246
  </svg>`
251
247
 
252
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
248
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
253
249
  t.is(typeof obs, 'string')
254
250
  t.is(countOf('path2.fromPoints', obs), 1)
255
251
  t.is(countOf('path2.appendPoints', obs), 1)
256
252
  t.is(countOf('path2.appendArc', obs), 1)
257
253
  t.is(countOf('path2.appendBezier', obs), 1)
258
254
  t.is(countOf('path2.close', obs), 1)
259
- t.is(countOf('geom2.fromPoints', obs), 0)
255
+ t.is(countOf('geom2.create', obs), 0)
260
256
 
261
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
257
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
262
258
  t.is(typeof obs, 'string')
263
259
  t.is(countOf('path2.fromPoints', obs), 1)
264
260
  t.is(countOf('path2.appendPoints', obs), 1)
265
261
  t.is(countOf('path2.appendArc', obs), 1)
266
262
  t.is(countOf('path2.appendBezier', obs), 1)
267
263
  t.is(countOf('path2.close', obs), 1)
268
- t.is(countOf('geom2.fromPoints', obs), 1)
264
+ t.is(countOf('geom2.create', obs), 1)
269
265
 
270
266
  // absolute CUBIC bezier
271
267
  // relative CUBIC bezier
@@ -273,24 +269,24 @@ test('deserialize : translate svg (path: bezier) to script', (t) => {
273
269
  <path d="M 240 90 c 0 30 7 50 50 0 c 43 -50 50 -30 50 0 c 0 83 -68 -34 -90 -30 C 240 60 240 90 240 90 z"/>
274
270
  </svg>`
275
271
 
276
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
272
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
277
273
  t.is(typeof obs, 'string')
278
274
  t.is(countOf('path2.fromPoints', obs), 1)
279
275
  t.is(countOf('path2.appendBezier', obs), 4)
280
276
  t.is(countOf('path2.close', obs), 1)
281
- t.is(countOf('geom2.fromPoints', obs), 0)
277
+ t.is(countOf('geom2.create', obs), 0)
282
278
 
283
279
  // absolute QUADRATIC bezier
284
280
  sourceSvg = `<svg height="500" width="500">
285
281
  <path d="M 60 100 Q -40 150 60 200 Q 160 150 60 100 z"/>
286
282
  </svg>`
287
283
 
288
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
284
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
289
285
  t.is(typeof obs, 'string')
290
286
  t.is(countOf('path2.fromPoints', obs), 1)
291
287
  t.is(countOf('path2.appendBezier', obs), 2)
292
288
  t.is(countOf('path2.close', obs), 1)
293
- t.is(countOf('geom2.fromPoints', obs), 0)
289
+ t.is(countOf('geom2.create', obs), 0)
294
290
 
295
291
  // absolute CUBIC bezier shorthand
296
292
  // relative CUBIC bezier shorthand
@@ -298,12 +294,12 @@ test('deserialize : translate svg (path: bezier) to script', (t) => {
298
294
  <path d="M 210 130 C 145 130 110 80 110 80 S 75 25 10 25 m 0 105 c 65 0 100 -50 100 -50 s 35 -55 100 -55"/>
299
295
  </svg>`
300
296
 
301
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
297
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
302
298
  t.is(typeof obs, 'string')
303
299
  t.is(countOf('path2.fromPoints', obs), 2)
304
300
  t.is(countOf('path2.appendBezier', obs), 4)
305
301
  t.is(countOf('path2.close', obs), 0)
306
- t.is(countOf('geom2.fromPoints', obs), 0)
302
+ t.is(countOf('geom2.create', obs), 0)
307
303
 
308
304
  // absolute QUADRATIC bezier shorthand
309
305
  // relative QUADRATIC bezier shorthand
@@ -311,23 +307,23 @@ test('deserialize : translate svg (path: bezier) to script', (t) => {
311
307
  <path d="M 10 80 Q 52.5 10 95 80 T 180 80"/>
312
308
  </svg>`
313
309
 
314
- obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
310
+ obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
315
311
  t.is(typeof obs, 'string')
316
312
  t.is(countOf('path2.fromPoints', obs), 1)
317
313
  t.is(countOf('path2.appendBezier', obs), 2)
318
314
  t.is(countOf('path2.close', obs), 0)
319
- t.is(countOf('geom2.fromPoints', obs), 0)
315
+ t.is(countOf('geom2.create', obs), 0)
320
316
 
321
317
  sourceSvg = `<svg height="500" width="500">
322
318
  <path id="Sin_Mqttttz" fill="#FF0000" d="M240 296 q25-100 47 0 t47 0 t47 0 t47 0 t47 0 z"/>
323
319
  </svg>`
324
320
 
325
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
321
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
326
322
  t.is(typeof obs, 'string')
327
323
  t.is(countOf('path2.fromPoints', obs), 1)
328
324
  t.is(countOf('path2.appendBezier', obs), 5)
329
325
  t.is(countOf('path2.close', obs), 1)
330
- t.is(countOf('geom2.fromPoints', obs), 1)
326
+ t.is(countOf('geom2.create', obs), 1)
331
327
  t.is(countOf('colors.colorize', obs), 1) // fill
332
328
  })
333
329
 
@@ -340,20 +336,20 @@ test('deserialize : translate shape with a hole to script', (t) => {
340
336
  </svg>
341
337
  `
342
338
 
343
- let obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
339
+ let obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
344
340
  t.is(typeof obs, 'string')
345
341
  t.is(countOf('path2.fromPoints', obs), 2)
346
342
  t.is(countOf('path2.appendArc', obs), 8)
347
343
  t.is(countOf('path2.close', obs), 2)
348
- t.is(countOf('geom2.fromPoints', obs), 0)
344
+ t.is(countOf('geom2.create', obs), 0)
349
345
  t.is(countOf('colors.colorize', obs), 1) // stroke
350
346
 
351
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
347
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
352
348
  t.is(typeof obs, 'string')
353
349
  t.is(countOf('path2.fromPoints', obs), 2)
354
350
  t.is(countOf('path2.appendArc', obs), 8)
355
351
  t.is(countOf('path2.close', obs), 2)
356
- t.is(countOf('geom2.fromPoints', obs), 2)
352
+ t.is(countOf('geom2.create', obs), 2)
357
353
  t.is(countOf('colors.colorize', obs), 1) // stroke
358
354
  })
359
355
 
@@ -363,21 +359,21 @@ test('deserialize : translate shape with a nested hole to script', (t) => {
363
359
  </svg>
364
360
  `
365
361
 
366
- let obs = deserializer.deserialize({ output: 'script', addMetaData: false }, sourceSvg)
362
+ let obs = deserialize({ output: 'script', addMetaData: false }, sourceSvg)
367
363
  t.is(typeof obs, 'string')
368
364
  t.is(countOf('path2.fromPoints', obs), 4)
369
365
  t.is(countOf('path2.appendArc', obs), 8)
370
366
  t.is(countOf('path2.appendBezier', obs), 16)
371
367
  t.is(countOf('path2.close', obs), 4)
372
- t.is(countOf('geom2.fromPoints', obs), 0)
368
+ t.is(countOf('geom2.create', obs), 0)
373
369
 
374
- obs = deserializer.deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
370
+ obs = deserialize({ output: 'script', target: 'geom2', addMetaData: false }, sourceSvg)
375
371
  t.is(typeof obs, 'string')
376
372
  t.is(countOf('path2.fromPoints', obs), 4)
377
373
  t.is(countOf('path2.appendArc', obs), 8)
378
374
  t.is(countOf('path2.appendBezier', obs), 16)
379
375
  t.is(countOf('path2.close', obs), 4)
380
- t.is(countOf('geom2.fromPoints', obs), 4)
376
+ t.is(countOf('geom2.create', obs), 4)
381
377
  })
382
378
 
383
379
  // ################################
@@ -394,7 +390,7 @@ test('deserialize : translate svg with simple defs to script', (t) => {
394
390
  </g>
395
391
  </svg>`
396
392
 
397
- const obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
393
+ const obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
398
394
  t.is(typeof obs, 'string')
399
395
  t.is(countOf('ellipse', obs), 1)
400
396
  t.is(countOf('path2.fromPoints', obs), 1)
@@ -422,7 +418,7 @@ test('deserialize : translate svg with defs using defs to script', (t) => {
422
418
  </g>
423
419
  </svg>`
424
420
 
425
- const obs = deserializer.deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
421
+ const obs = deserialize({ output: 'script', target: 'path', addMetaData: false }, sourceSvg)
426
422
  t.is(typeof obs, 'string')
427
423
  t.is(countOf('ellipse', obs), 1)
428
424
  t.is(countOf('path2.fromPoints', obs), 1)