@@ -23,6 +23,9 @@ describe('weave', function () {
2323 ] ) ;
2424 } ) ;
2525
26+ /**
27+ * weave(2, 1, 3) = weave([2,1], 3) + weave([2,3], 1)
28+ */
2629 it ( 'should weave given two arrays' , function ( ) {
2730 const prefix = 2 ;
2831 const arrays1 = [ [ 1 ] ] ;
@@ -35,7 +38,7 @@ describe('weave', function () {
3538 } ) ;
3639
3740 /**
38- * weave(5, [3,2], [8]) = weave([5,3,2 ], [], [8]) + weave([5, 8], [3,2], [])
41+ * weave(5, [3,2], [8]) = weave([5,3], [2 ], [8]) + weave([5, 8], [3,2], [])
3942 */
4043 it ( 'should cross array 1 with array 2 keeping the same order' , function ( ) {
4144 const prefix = 5 ;
@@ -49,6 +52,41 @@ describe('weave', function () {
4952 expect ( weave ( prefix , arrays1 , arrays2 ) ) . to . eql ( weaved ) ;
5053 } ) ;
5154
55+ /**
56+ * weave([5,3,2], 1, 8) + weave([5,3,8])
57+ */
58+ it ( 'should cross array 1 with array 2 keeping the same order' , function ( ) {
59+ const prefix = 5 ;
60+ const arrays1 = [ [ 3 , 2 , 1 ] ] ;
61+ const arrays2 = [ [ 8 ] ] ;
62+ const weaved = [
63+ [ 5 , 3 , 2 , 1 , 8 ] ,
64+ [ 5 , 3 , 2 , 8 , 1 ] ,
65+ [ 5 , 3 , 8 , 2 , 1 ] ,
66+ [ 5 , 8 , 3 , 2 , 1 ] ,
67+ ] ;
68+ expect ( weave ( prefix , arrays1 , arrays2 ) ) . to . eql ( weaved ) ;
69+ } ) ;
70+
71+ it ( 'should cross array 1 with array 2 keeping the same order' , function ( ) {
72+ const prefix = 5 ;
73+ const arrays1 = [ [ 3 , 2 , 1 ] ] ;
74+ const arrays2 = [ [ 8 , 9 ] ] ;
75+ const weaved = [
76+ [ 5 , 3 , 2 , 1 , 8 , 9 ] ,
77+ [ 5 , 3 , 2 , 8 , 1 , 9 ] ,
78+ [ 5 , 3 , 2 , 8 , 9 , 1 ] ,
79+ [ 5 , 3 , 8 , 2 , 1 , 9 ] ,
80+ [ 5 , 3 , 8 , 2 , 9 , 1 ] ,
81+ [ 5 , 3 , 8 , 9 , 2 , 1 ] ,
82+ [ 5 , 8 , 3 , 2 , 1 , 9 ] ,
83+ [ 5 , 8 , 3 , 2 , 9 , 1 ] ,
84+ [ 5 , 8 , 3 , 9 , 2 , 1 ] ,
85+ [ 5 , 8 , 9 , 3 , 2 , 1 ] ,
86+ ] ;
87+ expect ( weave ( prefix , arrays1 , arrays2 ) ) . to . eql ( weaved ) ;
88+ } ) ;
89+
5290 it ( 'should cross array 2 with array 1 keeping the same order' , function ( ) {
5391 const prefix = 5 ;
5492 const arrays1 = [ [ 3 ] ] ;
0 commit comments