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

Body.getAngularSpeed unit tests

This commit is contained in:
gsenden 2024-05-31 20:48:38 +02:00
parent 48c9a89bad
commit fcb9d206f7

View file

@ -1698,6 +1698,31 @@ describe('Body.setAngularVelocity', () => {
// Act
let result = () => Body.setAngularVelocity(body, velocity);
// Assert
// TODO: This causes a read or set from undefined. This should probably be fixed.
expect(result).toThrow(/^Cannot .* properties of undefined \(.* '.*'\)$/);
});
});
describe('Body.getAngularSpeed', () => {
it('should be able to get the angular speed from a valid body', () => {
// Arrange
const body = getTestBodyWithPartsWithParent();
// Act
let result = Body.getAngularSpeed(body);
// Assert
assertFloat(result, 0.13333333333333333);
});
it('should not be able to get the angular speed from an undefined body', () => {
// Arrange
const body = undefined;
// Act
let result = () => Body.getAngularSpeed(body);
// Assert
// TODO: This causes a read or set from undefined. This should probably be fixed.
expect(result).toThrow(/^Cannot .* properties of undefined \(.* '.*'\)$/);