File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/collection/__tests__ Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -713,6 +713,11 @@ describe('reduce() tests', () => {
713713 expect < number > ( sum ) . toStrictEqual ( 6 ) ;
714714 } ) ;
715715
716+ test ( 'reduce collection into a single value with different accumulator type' , ( ) => {
717+ const str = coll . reduce ( ( a , x ) => a . concat ( x . toString ( ) ) , '' ) ;
718+ expect < string > ( str ) . toStrictEqual ( '123' ) ;
719+ } ) ;
720+
716721 test ( 'reduce empty collection with initial value' , ( ) => {
717722 const coll = createCollection ( ) ;
718723 expect < number > ( coll . reduce ( ( a , x ) => a + x , 0 ) ) . toStrictEqual ( 0 ) ;
@@ -746,6 +751,11 @@ describe('reduceRight() tests', () => {
746751 expect < number > ( sum ) . toStrictEqual ( 6 ) ;
747752 } ) ;
748753
754+ test ( 'reduce collection into a single value with different accumulator type' , ( ) => {
755+ const str = coll . reduceRight ( ( a , x ) => a . concat ( x . toString ( ) ) , '' ) ;
756+ expect < string > ( str ) . toStrictEqual ( '321' ) ;
757+ } ) ;
758+
749759 test ( 'reduce empty collection with initial value' , ( ) => {
750760 const coll = createCollection ( ) ;
751761 expect < number > ( coll . reduceRight ( ( a , x ) => a + x , 0 ) ) . toStrictEqual ( 0 ) ;
You can’t perform that action at this time.
0 commit comments