0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-03-14 00:38:41 -04:00

Vertices.hull unit tests

This commit is contained in:
gsenden 2024-05-20 11:10:53 +02:00
parent 7aec8ec58d
commit 9b7e93b582

View file

@ -874,5 +874,35 @@ describe('Vertices.clockwiseSort', () => {
// TODO: This causes a read from undefined. This should probably be fixed.
expect(result).toThrow("Cannot read properties of undefined (reading 'length')");
});
});
describe('Vertices.hull', () => {
it('should be able to hull valid vertices', () => {
// Arrange
const vertices = getTestVerticesSqaureWithoutBody();
// Act
const result = Vertices.hull(vertices);
// Assert
assertXY(result[0], 3., 3.);
assertXY(result[1], 1., 3.);
assertXY(result[2], 1., 1.);
assertXY(result[3], 3., 1.);
});
it('should not be able to hull undefined vertices', () => {
// Arrange
const vertices = undefined;
// Act
const result = () => Vertices.hull(vertices);
// Assert
// TODO: This causes a read from undefined. This should probably be fixed.
expect(result).toThrow("Cannot read properties of undefined (reading 'slice')");
});
});