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

Vertices.mean unit tests

This commit is contained in:
gsenden 2024-05-17 21:56:50 +02:00
parent bc22f035fa
commit 14b036a5d7

View file

@ -354,5 +354,32 @@ describe('Vertices.centre', () => {
// TODO: This causes a read from undefined. This should probably be fixed.
expect(result).toThrow("Cannot read properties of undefined (reading 'length')");
});
});
describe('Vertices.mean', () => {
it('should be able to get the mean of the valid vertices', () => {
// Arrange
const vertices = testVerticesSqaureWithoutBody;
// Act
const result = Vertices.mean(vertices);
// Assert
assertXY(result, 2., 2.);
});
it('should not be able to get the mean of undefined vertices', () => {
// Arrange
const vertices = undefined;
// Act
const result = () => Vertices.mean(vertices);
// Assert
// TODO: This causes a read from undefined. This should probably be fixed.
expect(result).toThrow("Cannot read properties of undefined (reading 'length')");
});
});