Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
*/

import SpringAnimation from '../animations/SpringAnimation';

describe('SpringAnimation (web)', () => {
test('rejects a non-positive stiffness value', () => {
expect(
() => new SpringAnimation({ toValue: 1, stiffness: 0, damping: 10, mass: 1 })
).toThrow('Stiffness value must be greater than 0');
});

test('rejects a non-positive damping value', () => {
expect(
() => new SpringAnimation({ toValue: 1, stiffness: 100, damping: 0, mass: 1 })
).toThrow('Damping value must be greater than 0');
});

test('rejects a non-positive mass value', () => {
expect(
() => new SpringAnimation({ toValue: 1, stiffness: 100, damping: 10, mass: 0 })
).toThrow('Mass value must be greater than 0');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class SpringAnimation implements AnimatedAnimation {
throw new Error('Damping value must be greater than 0');
}
if (this.#mass <= 0) {
throw new Error('Damping value must be greater than 0');
throw new Error('Mass value must be greater than 0');
}
}

Expand Down