Skip to content

Commit

Permalink
tests(modeling): added test for polygon orientation
Browse files Browse the repository at this point in the history
  • Loading branch information
z3dev committed Jan 14, 2024
1 parent 3baab05 commit f9cb34c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/modeling/src/primitives/polygon.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const test = require('ava')

const geom2 = require('../geometries/geom2')
const measureArea = require('../measurements/measureArea')

const { polygon } = require('./index')

Expand Down Expand Up @@ -51,3 +52,12 @@ test('polygon: providing object.points (array) and object.path (array) creates e
t.notThrows(() => geom2.validate(geometry))
t.true(comparePoints(obs, exp))
})

test('polygon: clockwise points', (t) => {
const poly = polygon({
points: [[-10, -0], [-10, -10], [-15, -5]],
orientation: "clockwise",
})
t.is(poly.sides.length, 3)
t.is(measureArea(poly), 25)
})

0 comments on commit f9cb34c

Please sign in to comment.