File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 3
3
point ,
4
4
lineString ,
5
5
polygon ,
6
+ feature ,
6
7
featureCollection ,
7
8
geometryCollection ,
8
9
} from "@turf/helpers" ;
@@ -319,3 +320,29 @@ test("turf-clone -- Feature with null geometry", (t) => {
319
320
t . deepEqual ( fc , cloned ) ;
320
321
t . end ( ) ;
321
322
} ) ;
323
+
324
+ test ( "turf-clone -- Feature with property called 'length', issue #1621" , ( t ) => {
325
+ const f = feature (
326
+ { type : "Point" , coordinates : [ 0 , 0 ] } ,
327
+ {
328
+ processed : {
329
+ length : {
330
+ orig : 123.456 ,
331
+ opti : 100.0 ,
332
+ } ,
333
+ } ,
334
+ }
335
+ ) ;
336
+
337
+ // Clone
338
+ const cloned = clone ( f ) ;
339
+
340
+ t . deepEqual ( f , cloned , "cloned feature should be deeply equal" ) ;
341
+ t . equal (
342
+ cloned . properties . processed . length . orig ,
343
+ 123.456 ,
344
+ "'orig' property should be preserved on 'processed.length' element"
345
+ ) ;
346
+
347
+ t . end ( ) ;
348
+ } ) ;
You can’t perform that action at this time.
0 commit comments