@@ -389,6 +389,37 @@ test.each([
389389 ` . expectToMatchJsResult ( ) ;
390390} ) ;
391391
392+ test . each ( [
393+ { array : [ 1 , 2 , 3 ] , includes : 2 } ,
394+ { array : [ 1 , 2 , 3 , 2 , 2 ] , includes : 2 } ,
395+ { array : [ 1 , 2 , 3 ] , includes : 4 } ,
396+ { array : [ "a" , "b" , "c" ] , includes : "d" } ,
397+ { array : [ [ 1 ] , [ 2 ] , [ 3 ] ] , includes : [ 2 ] } ,
398+ { array : [ 1 , [ 2 ] , 3 ] , includes : 2 } ,
399+ ] ) ( "array.includes (%p)" , ( { array, includes } ) => {
400+ util . testExpressionTemplate `${ array } .includes(${ includes } )` . expectToMatchJsResult ( ) ;
401+ } ) ;
402+
403+ test ( "array.includes reference" , ( ) => {
404+ util . testFunction `
405+ const inst = [2];
406+ return [[1], [3], inst].includes(inst);
407+ ` . expectToMatchJsResult ( ) ;
408+ } ) ;
409+
410+ test . each ( [
411+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : 0 } ,
412+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : 1 } ,
413+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : 2 } ,
414+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : 3 } ,
415+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : - 1 } ,
416+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : - 2 } ,
417+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : - 3 } ,
418+ { array : [ 1 , 2 , 3 ] , includes : 2 , fromIndex : - 4 } ,
419+ ] ) ( "array.includes with fromIndex (%p)" , ( { array, includes, fromIndex } ) => {
420+ util . testExpressionTemplate `${ array } .includes(${ includes } , ${ fromIndex } )` . expectToMatchJsResult ( ) ;
421+ } ) ;
422+
392423test . each ( [
393424 { array : [ ] } ,
394425 { array : [ "test1" ] } ,
0 commit comments