11import type { NestedArray } from '../../src/utils-hoist/array' ;
2+ // eslint-disable-next-line deprecation/deprecation
23import { flatten } from '../../src/utils-hoist/array' ;
34
45describe ( 'flatten' , ( ) => {
56 it ( 'should return the same array when input is a flat array' , ( ) => {
67 const input = [ 1 , 2 , 3 , 4 ] ;
78 const expected = [ 1 , 2 , 3 , 4 ] ;
9+ // eslint-disable-next-line deprecation/deprecation
810 expect ( flatten ( input ) ) . toEqual ( expected ) ;
911 } ) ;
1012
1113 it ( 'should flatten a nested array of numbers' , ( ) => {
1214 const input = [ [ 1 , 2 , [ 3 ] ] , 4 ] ;
1315 const expected = [ 1 , 2 , 3 , 4 ] ;
16+ // eslint-disable-next-line deprecation/deprecation
1417 expect ( flatten ( input ) ) . toEqual ( expected ) ;
1518 } ) ;
1619
@@ -20,6 +23,7 @@ describe('flatten', () => {
2023 [ 'How' , 'Are' , 'You' ] ,
2124 ] ;
2225 const expected = [ 'Hello' , 'World' , 'How' , 'Are' , 'You' ] ;
26+ // eslint-disable-next-line deprecation/deprecation
2327 expect ( flatten ( input ) ) . toEqual ( expected ) ;
2428 } ) ;
2529
@@ -29,30 +33,35 @@ describe('flatten', () => {
2933 [ { a : 3 } , { b : 4 } ] ,
3034 ] ;
3135 const expected = [ { a : 1 } , { b : 2 } , { a : 3 } , { b : 4 } ] ;
36+ // eslint-disable-next-line deprecation/deprecation
3237 expect ( flatten ( input ) ) . toEqual ( expected ) ;
3338 } ) ;
3439
3540 it ( 'should flatten a mixed type array' , ( ) => {
3641 const input : NestedArray < string | { b : number } > = [ [ 'a' , { b : 2 } , 'c' ] , 'd' ] ;
3742 const expected = [ 'a' , { b : 2 } , 'c' , 'd' ] ;
43+ // eslint-disable-next-line deprecation/deprecation
3844 expect ( flatten ( input ) ) . toEqual ( expected ) ;
3945 } ) ;
4046
4147 it ( 'should flatten a deeply nested array' , ( ) => {
4248 const input = [ 1 , [ 2 , [ 3 , [ 4 , [ 5 ] ] ] ] ] ;
4349 const expected = [ 1 , 2 , 3 , 4 , 5 ] ;
50+ // eslint-disable-next-line deprecation/deprecation
4451 expect ( flatten ( input ) ) . toEqual ( expected ) ;
4552 } ) ;
4653
4754 it ( 'should return an empty array when input is empty' , ( ) => {
4855 const input : any [ ] = [ ] ;
4956 const expected : any [ ] = [ ] ;
57+ // eslint-disable-next-line deprecation/deprecation
5058 expect ( flatten ( input ) ) . toEqual ( expected ) ;
5159 } ) ;
5260
5361 it ( 'should return the same array when input is a flat array' , ( ) => {
5462 const input = [ 1 , 'a' , { b : 2 } , 'c' , 3 ] ;
5563 const expected = [ 1 , 'a' , { b : 2 } , 'c' , 3 ] ;
64+ // eslint-disable-next-line deprecation/deprecation
5665 expect ( flatten ( input ) ) . toEqual ( expected ) ;
5766 } ) ;
5867} ) ;
0 commit comments