Skip to content

Commit

Permalink
Added a regression test for clone() bug that was probably fixed a whi…
Browse files Browse the repository at this point in the history
…le ago. (#2749)
  • Loading branch information
smallsaucepan authored Nov 19, 2024
1 parent 5377c1c commit 0da7ada
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/turf-clone/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
point,
lineString,
polygon,
feature,
featureCollection,
geometryCollection,
} from "@turf/helpers";
Expand Down Expand Up @@ -319,3 +320,29 @@ test("turf-clone -- Feature with null geometry", (t) => {
t.deepEqual(fc, cloned);
t.end();
});

test("turf-clone -- Feature with property called 'length', issue #1621", (t) => {
const f = feature(
{ type: "Point", coordinates: [0, 0] },
{
processed: {
length: {
orig: 123.456,
opti: 100.0,
},
},
}
);

// Clone
const cloned = clone(f);

t.deepEqual(f, cloned, "cloned feature should be deeply equal");
t.equal(
cloned.properties.processed.length.orig,
123.456,
"'orig' property should be preserved on 'processed.length' element"
);

t.end();
});

0 comments on commit 0da7ada

Please sign in to comment.