diff --git a/test/index.js b/test/index.js index 4c870bd..10e19d0 100644 --- a/test/index.js +++ b/test/index.js @@ -138,6 +138,12 @@ for (const feature of complexApproachFeatures) { const ring = feature.geometry?.coordinates?.[0] || []; assert.ok(ring.length >= 4 && ring[0][0] === ring.at(-1)[0] && ring[0][1] === ring.at(-1)[1]); assert.ok(ring.every((coordinate) => coordinate.every(Number.isFinite))); + const area = Math.abs( + ring + .slice(1) + .reduce((sum, coordinate, index) => sum + ring[index][0] * coordinate[1] - coordinate[0] * ring[index][1], 0) / 2, + ); + assert.ok(area > 0, 'compiled complex approach surface must have positive area'); } const complexFeatures = Object.values(complexGeometry).flatMap((layer) => layer?.features || []); assert.equal(