Skip to content

Commit 91444ad

Browse files
test(helper-specs): add test cases for isIntegerArray method
1 parent 4c8ec32 commit 91444ad

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/helper-specs.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,27 @@ describe( 'isFiniteInteger', function () {
9898
} );
9999
} );
100100
} );
101+
102+
describe( 'isIntegerArray', function () {
103+
var tests = [
104+
{ expectedOutputIs: false, whenInputIs: undefined },
105+
{ expectedOutputIs: false, whenInputIs: null },
106+
{ expectedOutputIs: false, whenInputIs: [] },
107+
{ expectedOutputIs: false, whenInputIs: [ -1.1 ] },
108+
{ expectedOutputIs: false, whenInputIs: [ 1.00001 ] },
109+
{ expectedOutputIs: false, whenInputIs: [ {} ] },
110+
{ expectedOutputIs: false, whenInputIs: [ [] ] },
111+
{ expectedOutputIs: false, whenInputIs: [ 1, 2, [] ] },
112+
{ expectedOutputIs: false, whenInputIs: [ 1, 2, {} ] },
113+
{ expectedOutputIs: false, whenInputIs: [ 1, 2, 1.1 ] },
114+
{ expectedOutputIs: true, whenInputIs: [ 1 ] },
115+
{ expectedOutputIs: true, whenInputIs: [ 999999 ] },
116+
{ expectedOutputIs: true, whenInputIs: [ -999999 ] },
117+
{ expectedOutputIs: true, whenInputIs: [ -999999, 1, 2 ] }
118+
];
119+
tests.forEach( function ( t ) {
120+
it( 'should return ' + JSON.stringify( t.expectedOutputIs ) + '\n\tif the input is ' + JSON.stringify( t.whenInputIs ), function () {
121+
expect( helper.isIntegerArray( t.whenInputIs ) ).to.equal( t.expectedOutputIs );
122+
} );
123+
} );
124+
} );

0 commit comments

Comments
 (0)