mirror of
https://github.com/liabru/matter-js.git
synced 2025-03-14 00:38:41 -04:00
Body.getSpeed unit tests
This commit is contained in:
parent
5b06c485a1
commit
2fc7fff2a6
1 changed files with 25 additions and 0 deletions
|
@ -1584,4 +1584,29 @@ describe('Body.getVelocity', () => {
|
|||
expect(result).toThrow(/^Cannot .* properties of undefined \(.* '.*'\)$/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Body.getSpeed', () => {
|
||||
it('should be able to get the speed from a valid body', () => {
|
||||
// Arrange
|
||||
const body = getTestBodyWithPartsWithParent();
|
||||
|
||||
// Act
|
||||
let result = Body.getSpeed(body);
|
||||
|
||||
// Assert
|
||||
assertFloat(result, 0.7542472332656507);
|
||||
});
|
||||
|
||||
it('should not be able to get the speed from an undefined body', () => {
|
||||
// Arrange
|
||||
const body = undefined;
|
||||
|
||||
// Act
|
||||
let result = () => Body.getSpeed(body);
|
||||
|
||||
// Assert
|
||||
// TODO: This causes a read or set from undefined. This should probably be fixed.
|
||||
expect(result).toThrow(/^Cannot .* properties of undefined \(.* '.*'\)$/);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue