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:
parent
7aec8ec58d
commit
9b7e93b582
1 changed files with 30 additions and 0 deletions
|
@ -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')");
|
||||
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue