mirror of
https://github.com/liabru/matter-js.git
synced 2025-03-14 00:38:41 -04:00
Vertices.centre unit tests
This commit is contained in:
parent
0c151ae7e7
commit
bc22f035fa
1 changed files with 28 additions and 1 deletions
|
@ -328,4 +328,31 @@ describe('Vertices.rotate', () => {
|
|||
expect(result).toThrow("Cannot read properties of undefined (reading 'length')");
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Vertices.centre', () => {
|
||||
it('should be able to get the centre of the valid vertices', () => {
|
||||
// Arrange
|
||||
const vertices = testVerticesSqaureWithoutBody;
|
||||
|
||||
// Act
|
||||
const result = Vertices.centre(vertices);
|
||||
|
||||
// Assert
|
||||
assertXY(result, 2., 2.);
|
||||
|
||||
});
|
||||
|
||||
it('should not be able to get the centre of undefined vertices', () => {
|
||||
// Arrange
|
||||
const vertices = undefined;
|
||||
|
||||
// Act
|
||||
const result = () => Vertices.centre(vertices);
|
||||
|
||||
// Assert
|
||||
// TODO: This causes a read from undefined. This should probably be fixed.
|
||||
expect(result).toThrow("Cannot read properties of undefined (reading 'length')");
|
||||
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue