Skip to content

Commit

Permalink
test(helper-specs): add test cases for isIntegerArray method
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayaksaxena committed Dec 3, 2022
1 parent 4c8ec32 commit 91444ad
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/helper-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,27 @@ describe( 'isFiniteInteger', function () {
} );
} );
} );

describe( 'isIntegerArray', function () {
var tests = [
{ expectedOutputIs: false, whenInputIs: undefined },
{ expectedOutputIs: false, whenInputIs: null },
{ expectedOutputIs: false, whenInputIs: [] },
{ expectedOutputIs: false, whenInputIs: [ -1.1 ] },
{ expectedOutputIs: false, whenInputIs: [ 1.00001 ] },
{ expectedOutputIs: false, whenInputIs: [ {} ] },
{ expectedOutputIs: false, whenInputIs: [ [] ] },
{ expectedOutputIs: false, whenInputIs: [ 1, 2, [] ] },
{ expectedOutputIs: false, whenInputIs: [ 1, 2, {} ] },
{ expectedOutputIs: false, whenInputIs: [ 1, 2, 1.1 ] },
{ expectedOutputIs: true, whenInputIs: [ 1 ] },
{ expectedOutputIs: true, whenInputIs: [ 999999 ] },
{ expectedOutputIs: true, whenInputIs: [ -999999 ] },
{ expectedOutputIs: true, whenInputIs: [ -999999, 1, 2 ] }
];
tests.forEach( function ( t ) {
it( 'should return ' + JSON.stringify( t.expectedOutputIs ) + '\n\tif the input is ' + JSON.stringify( t.whenInputIs ), function () {
expect( helper.isIntegerArray( t.whenInputIs ) ).to.equal( t.expectedOutputIs );
} );
} );
} );

0 comments on commit 91444ad

Please sign in to comment.