mirror of
https://github.com/liabru/matter-js.git
synced 2025-03-14 00:38:41 -04:00
Bounds.shift unit tests
This commit is contained in:
parent
6f3dfe4c38
commit
4a98c99bff
1 changed files with 41 additions and 1 deletions
|
@ -220,4 +220,44 @@ describe('Bounds.translate', () => {
|
|||
// TODO: This causes a read from undefined. This should probably be fixed.
|
||||
expect(result).toThrow(/^Cannot read properties of undefined \(reading '.*'\)$/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Bounds.shift', () => {
|
||||
it('should be able to shift bounds with valid vector', () => {
|
||||
// Arrange
|
||||
const bounds = getTestBounds();
|
||||
const vector = Vector.create(4., 1.);
|
||||
|
||||
// Act
|
||||
Bounds.shift(bounds, vector);
|
||||
|
||||
// Assert
|
||||
assertBounds(bounds, 4., 1., 104., 101.);
|
||||
});
|
||||
|
||||
it('should not be able to shift bounds with undefined vector', () => {
|
||||
// Arrange
|
||||
const bounds = getTestBounds();
|
||||
const vector = undefined;
|
||||
|
||||
// Act
|
||||
const result = () => Bounds.shift(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 shift undefined bounds with valid vector', () => {
|
||||
// Arrange
|
||||
const bounds = undefined;
|
||||
const vector = Vector.create(4., 1.);;
|
||||
|
||||
// Act
|
||||
const result = () => Bounds.shift(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