Skip to content

Commit

Permalink
factor out if ( window.assert )
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Aug 17, 2021
1 parent 90df01f commit d8c1c51
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions js/UtilsTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,17 @@ QUnit.test( 'numberOfDecimalPlaces', assert => {
assert.equal( Utils.numberOfDecimalPlaces( 1e50 ), 0 ); // scientific notation is supported for integers

// Tests that should fail.
window.assert && assert.throws( () => {
Utils.numberOfDecimalPlaces( 'foo' );
}, 'value must be a number' );
window.assert && assert.throws( () => {
Utils.numberOfDecimalPlaces( Infinity );
}, 'value must be a finite number' );
window.assert && assert.throws( () => {
Utils.numberOfDecimalPlaces( 1e-50 );
}, 'scientific notation is not supported for decimals' );
if ( window.assert ) {
assert.throws( () => {
Utils.numberOfDecimalPlaces( 'foo' );
}, 'value must be a number' );
assert.throws( () => {
Utils.numberOfDecimalPlaces( Infinity );
}, 'value must be a finite number' );
assert.throws( () => {
Utils.numberOfDecimalPlaces( 1e-50 );
}, 'scientific notation is not supported for decimals' );
}
} );

QUnit.test( 'roundToInterval', assert => {
Expand Down

0 comments on commit d8c1c51

Please sign in to comment.