Skip to content

Add test for function reliant on turf dependency #769

Open
@cafca

Description

@cafca

We are using turf only for this single piece of code and therefore are not tracking changes in turf releases. To guard against breaking api changes in future turf releases etc. we should add a test for this function.

export function getCenterFromGeom(geometry, defaultCenter = null) {
if (geometry && geometry.coordinates) {
if (geometry.type === 'MultiLineString') {
geometry = turfLineString(
geometry.coordinates.reduce((res, coord) => res.concat(coord)),
[]
);
}
const length = turfLength(geometry);
return turfAlong(geometry, length * 0.5).geometry.coordinates;
}
return defaultCenter;
}

This is a good issue for first contributors. Please leave a message here if you would like assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions