@@ -38,40 +38,40 @@ describe('MSSQL: where_in()', () => {
3838 it ( 'should not accept anything but a non-empty array of values as second parameter' , ( ) => {
3939 qb . reset_query ( ) ;
4040 expect ( ( ) => qb . where_in ( 'planet' ) , 'nothing provided' ) . to . throw ( Error ) ;
41- expect ( ( ) => qb . where_in ( 'planet' , null ) , 'null provided' ) . to . throw ( Error ) ;
42- expect ( ( ) => qb . where_in ( 'planet' , false ) , 'false provided' ) . to . throw ( Error ) ;
43- expect ( ( ) => qb . where_in ( 'planet' , true ) , 'true provided' ) . to . throw ( Error ) ;
44- expect ( ( ) => qb . where_in ( 'planet' , { } ) , 'empty object provided' ) . to . throw ( Error ) ;
45- expect ( ( ) => qb . where_in ( 'planet' , { foo :'bar' } ) , 'empty object provided' ) . to . throw ( Error ) ;
46- expect ( ( ) => qb . where_in ( 'planet' , 3 ) , 'integer provided' ) . to . throw ( Error ) ;
47- expect ( ( ) => qb . where_in ( 'planet' , 3.5 ) , 'float provided' ) . to . throw ( Error ) ;
48- expect ( ( ) => qb . where_in ( 'planet' , NaN ) , 'NaN provided' ) . to . throw ( Error ) ;
49- expect ( ( ) => qb . where_in ( 'planet' , Infinity ) , 'Infinity provided' ) . to . throw ( Error ) ;
50- expect ( ( ) => qb . where_in ( 'planet' , [ ] ) , 'empty array provided' ) . to . throw ( Error ) ;
51- expect ( ( ) => qb . where_in ( 'planet' , '' ) , 'empty string provided' ) . to . throw ( Error ) ;
52- expect ( ( ) => qb . where_in ( 'planet' , / f o o b a r / ) , 'regex provided' ) . to . throw ( Error ) ;
41+ expect ( ( ) => qb . where_in ( 'planet' , null ) , 'null provided' ) . to . throw ( Error ) ;
42+ expect ( ( ) => qb . where_in ( 'planet' , false ) , 'false provided' ) . to . throw ( Error ) ;
43+ expect ( ( ) => qb . where_in ( 'planet' , true ) , 'true provided' ) . to . throw ( Error ) ;
44+ expect ( ( ) => qb . where_in ( 'planet' , { } ) , 'empty object provided' ) . to . throw ( Error ) ;
45+ expect ( ( ) => qb . where_in ( 'planet' , { foo :'bar' } ) , 'empty object provided' ) . to . throw ( Error ) ;
46+ expect ( ( ) => qb . where_in ( 'planet' , 3 ) , 'integer provided' ) . to . throw ( Error ) ;
47+ expect ( ( ) => qb . where_in ( 'planet' , 3.5 ) , 'float provided' ) . to . throw ( Error ) ;
48+ expect ( ( ) => qb . where_in ( 'planet' , NaN ) , 'NaN provided' ) . to . throw ( Error ) ;
49+ expect ( ( ) => qb . where_in ( 'planet' , Infinity ) , 'Infinity provided' ) . to . throw ( Error ) ;
50+ expect ( ( ) => qb . where_in ( 'planet' , [ ] ) , 'empty array provided' ) . to . throw ( Error ) ;
51+ expect ( ( ) => qb . where_in ( 'planet' , '' ) , 'empty string provided' ) . to . throw ( Error ) ;
52+ expect ( ( ) => qb . where_in ( 'planet' , / f o o b a r / ) , 'regex provided' ) . to . throw ( Error ) ;
5353
54- expect ( ( ) => qb . where_in ( 'planet' , [ 'Mars' , 'Earth' , 'Venus' , 'Mercury' ] ) , 'non-empty array provided' ) . to . not . throw ( Error ) ;
54+ expect ( ( ) => qb . where_in ( 'planet' , [ 'Mars' , 'Earth' , 'Venus' , 'Mercury' ] ) , 'non-empty array provided' ) . to . not . throw ( Error ) ;
5555 } ) ;
5656 it ( 'should require both a field name an array of values as first and second parameters, respectively' , ( ) => {
5757 qb . reset_query ( ) ;
58- qb . where_in ( 'planet_position' , [ 1 , 2 , 3 ] ) ;
58+ qb . where_in ( 'planet_position' , [ 1 , 2 , 3 ] ) ;
5959 qb . where_array . should . eql ( [ '[planet_position] IN (1, 2, 3)' ] ) ;
6060 } ) ;
6161 it ( 'should concatenate multiple WHERE IN clauses with AND ' , ( ) => {
6262 qb . reset_query ( ) ;
6363 qb . where_in ( 'planet' , [ 'Mercury' , 'Venus' , 'Earth' , 'Mars' ] ) ;
64- qb . where_in ( 'galaxy_id' , [ 123 , 456 , 789 , 0110 ] ) ;
64+ qb . where_in ( 'galaxy_id' , [ 123 , 456 , 789 , 0110 ] ) ;
6565 qb . where_array . should . eql ( [ "[planet] IN ('Mercury', 'Venus', 'Earth', 'Mars')" , "AND [galaxy_id] IN (123, 456, 789, 72)" ] ) ;
6666 } ) ;
6767 it ( 'should be chainable' , ( ) => {
6868 qb . reset_query ( ) ;
69- qb . where_in ( 'planet' , [ 'Mercury' , 'Venus' , 'Earth' , 'Mars' ] ) . where_in ( 'planet_position' , [ 1 , 2 , 3 , 4 ] ) ;
69+ qb . where_in ( 'planet' , [ 'Mercury' , 'Venus' , 'Earth' , 'Mars' ] ) . where_in ( 'planet_position' , [ 1 , 2 , 3 , 4 ] ) ;
7070 qb . where_array . should . eql ( [ "[planet] IN ('Mercury', 'Venus', 'Earth', 'Mars')" , "AND [planet_position] IN (1, 2, 3, 4)" ] ) ;
7171 } ) ;
7272 it ( 'should not escape fields if asked not to' , ( ) => {
7373 qb . reset_query ( ) ;
74- qb . where_in ( 'planet_position' , [ 1 , 2 , 3 ] , false ) ;
74+ qb . where_in ( 'planet_position' , [ 1 , 2 , 3 ] , false ) ;
7575 qb . where_array . should . eql ( [ 'planet_position IN (1, 2, 3)' ] ) ;
7676 } ) ;
7777} ) ;
0 commit comments