mirror of
https://github.com/liabru/matter-js.git
synced 2025-03-14 00:38:41 -04:00
Bounds.translate unit tests
This commit is contained in:
parent
11ade3cc96
commit
6f3dfe4c38
1 changed files with 40 additions and 0 deletions
|
@ -180,4 +180,44 @@ describe('Bounds.overlaps', () => {
|
|||
// TODO: This causes a read from undefined. This should probably be fixed.
|
||||
expect(result).toThrow(/^Cannot read properties of undefined \(reading '.*'\)$/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Bounds.translate', () => {
|
||||
it('should be able to translate bounds with valid vector', () => {
|
||||
// Arrange
|
||||
const bounds = getTestBounds();
|
||||
const vector = Vector.create(4., 1.);
|
||||
|
||||
// Act
|
||||
Bounds.translate(bounds, vector);
|
||||
|
||||
// Assert
|
||||
assertBounds(bounds, 104., 151., 204., 251.);
|
||||
});
|
||||
|
||||
it('should not be able to translate bounds with undefined vector', () => {
|
||||
// Arrange
|
||||
const bounds = getTestBounds();
|
||||
const vector = undefined;
|
||||
|
||||
// Act
|
||||
const result = () => Bounds.translate(bounds, vector);
|
||||
|
||||
// Assert
|
||||
// TODO: This causes a read from undefined. This should probably be fixed.
|
||||
expect(result).toThrow(/^Cannot read properties of undefined \(reading '.*'\)$/);
|
||||
});
|
||||
|
||||
it('should not be able to translate undefined bounds with valid vector', () => {
|
||||
// Arrange
|
||||
const bounds = undefined;
|
||||
const vector = Vector.create(4., 1.);;
|
||||
|
||||
// Act
|
||||
const result = () => Bounds.translate(bounds, vector);
|
||||
|
||||
// Assert
|
||||
// TODO: This causes a read from undefined. This should probably be fixed.
|
||||
expect(result).toThrow(/^Cannot read properties of undefined \(reading '.*'\)$/);
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue